[Tracking PR] feat: rewrite most style linters in Lean#13199
Closed
[Tracking PR] feat: rewrite most style linters in Lean#13199
Conversation
Unlike the Python version, this script also supports set_option tactics and terms.
…e option could be simply removed.
…r imports work; copyright header in progress. Missing: printing right errors, because of monadology. Also: need to register as linters somewhere... or figure out how to disable?
…eels clearer to me. Open to golfing that down :-)
Untested, as of now: will come next.
Isolated by's are still missing, and testing all of them!
Now, all linters work well in manual tests. "Isolated by" only lints very few cases; strengthen that next.
to implement exceptions in Lean yet.
Careful: Lean's FS.lines methods yields lines without trailing newline; I am not sure what this does to windows line endings. Need to check carefully!
d61b18a to
18e9c21
Compare
…enough. 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.
Contributor
Author
|
As a way to roll this out, I have rewritten |
Running all linters so far on all of mathlib runs in 1-2 seconds. (The Python script took 10, for the linters ported so far.)
Contributor
Author
|
Compiling the linter to an executable makes it much faster: now it's an order of magnitude faster than the Python linter. |
Use this to move the exception filtering out of formatErrors, while is slightly nicer anyway.
This reverts commit 660ea06.
Remove now-fixed copyright exceptions.
callesonne
pushed a commit
that referenced
this pull request
Jun 4, 2024
Discovered when tweaking the rewritten style linter in #13199.
callesonne
pushed a commit
that referenced
this pull request
Jun 4, 2024
Re-implementing the copyright header linter in #13199, I made the checker stricter in a few places. This was not intentional, but happened since I wasn't aiming at bug-for-bug compatibility: the old algorithm feels somewhat complicated for me. This led me to perform a few normalisations on the existing copyright headers: let me know if these are desired or not - normalise the copyright symbol in the first line (a few files had a different one) - add a dot in before the "All rights reserved" (again, only a few different ones) - three manual tweaks
js2357
pushed a commit
that referenced
this pull request
Jun 18, 2024
Discovered when tweaking the rewritten style linter in #13199.
js2357
pushed a commit
that referenced
this pull request
Jun 18, 2024
Re-implementing the copyright header linter in #13199, I made the checker stricter in a few places. This was not intentional, but happened since I wasn't aiming at bug-for-bug compatibility: the old algorithm feels somewhat complicated for me. This led me to perform a few normalisations on the existing copyright headers: let me know if these are desired or not - normalise the copyright symbol in the first line (a few files had a different one) - add a dot in before the "All rights reserved" (again, only a few different ones) - three manual tweaks
Contributor
Author
|
I think this PR has served its purpose; closing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is tracking PR for rewriting most linters in
lint-style.pyin Lean.Steps for landing this:
lint_styleexecutable to thescriptsdirectory #14057, to move the executable out ofMathlib/Tacticupdate-style-exceptionsin Lean #14273, rewriting the updating of style exceptions in Leanprofileroption #14006IO.FS.linesmethod returns lines without newline; I have not checked if this still works in the Windows case (help testing welcome; I don't have access to a Windows computer!)~~after one and a half rounds of optimisation, it's perhaps twice as slow as the python script was (with a few lints missing). See the inline comments for some details: on my machine, the Python script (before the rewrite, with a few more linters) takes ~12-14 seconds, which these linters take ~20-25s.~~
lint_styleexecutable into the build workflow; works nicelyupdate_style_exceptionsexecutable; this can run both the python script and the Lean linter (not implemented yet).