-
Notifications
You must be signed in to change notification settings - Fork 331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: rewrite update-style-exceptions.sh
as a Lean executable
#13245
Conversation
9316267
to
93a117c
Compare
… scripts/ It is needed in other scripts: the easiest way to depend on this is to move this to mathlib. Better places are welcome!
I'm passing all files as command line arguments: this is not how you're supposed to do it, but as a stop-gap measure, this is fine.
93a117c
to
00109e5
Compare
… `scripts` (#13339) With #13245, two scripts in `scripts` would like to use very similar information: move it to a central place instead (a file in `Mathlib/Util`). Suggestions for better locations are welcome! Also, split the `getAll` function in two pieces, getting the file names and transforming this into module names. While #11853 only requires the latter, #13245 needs the former (which is computed anyway). Only accessible the converted module names and converting them back to files would be absurd. - [x] depends on: #11853 which adds these utility functions
This PR/issue depends on: |
println! "error {out.exitCode} on updating style exceptions : {out.stderr}" | ||
return out.exitCode | ||
let lines := out.stdout.splitOn "\n" | ||
let final := "\n".intercalate (lines.toArray.qsort (· < ·)).toList |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not too happy about the list->array->list conversion: this is because
splitOn
returns aList String
qsort
requires anArray
to sortintercalate
requires aList String
again
Suggestions for avoiding this as welcome. It seems this difference isn't important for speed; this is purely an aesthetic thing.
… `scripts` (#13339) With #13245, two scripts in `scripts` would like to use very similar information: move it to a central place instead (a file in `Mathlib/Util`). Suggestions for better locations are welcome! Also, split the `getAll` function in two pieces, getting the file names and transforming this into module names. While #11853 only requires the latter, #13245 needs the former (which is computed anyway). Only accessible the converted module names and converting them back to files would be absurd. - [x] depends on: #11853 which adds these utility functions
… `scripts` (#13339) With #13245, two scripts in `scripts` would like to use very similar information: move it to a central place instead (a file in `Mathlib/Util`). Suggestions for better locations are welcome! Also, split the `getAll` function in two pieces, getting the file names and transforming this into module names. While #11853 only requires the latter, #13245 needs the former (which is computed anyway). Only accessible the converted module names and converting them back to files would be absurd. - [x] depends on: #11853 which adds these utility functions
Just as an update: I have an even better than rewriting just this file in Lean. Instead, I propose merging |
… `scripts` (#13339) With #13245, two scripts in `scripts` would like to use very similar information: move it to a central place instead (a file in `Mathlib/Util`). Suggestions for better locations are welcome! Also, split the `getAll` function in two pieces, getting the file names and transforming this into module names. While #11853 only requires the latter, #13245 needs the former (which is computed anyway). Only accessible the converted module names and converting them back to files would be absurd. - [x] depends on: #11853 which adds these utility functions
Let me close this in favour of #14273. |
This allows running both the Python and Lean style linters.
As a user, replace
./scripts/update-style-exceptions.sh
bylake exe update_style_exceptions
.The Lean version is slightly slower (1s vs 0.5), presumably due to some overhead of spawning processes/using
xargs
the way I do. I'm not inclined to worry.scripts
#13339 to remove the copy-pasted code frommk_all.lean