-
Notifications
You must be signed in to change notification settings - Fork 330
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
[Tracking PR] feat: rewrite most style linters in Lean #13199
Draft
grunweg
wants to merge
64
commits into
master
Choose a base branch
from
MR-rewrite-more-style-linters
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
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!
grunweg
added
t-linter
Linter
tech debt
Tracking cross-cutting technical debt, see e.g. the "Technical debt counters" stream on zulip
labels
May 25, 2024
Now, all linters work well in manual tests. "Isolated by" only lints very few cases; strengthen that next.
to implement exceptions in Lean yet.
leanprover-community-mathlib4-bot
added
the
blocked-by-other-PR
This PR depends on another PR to Mathlib (this label is automatically managed by a bot)
label
May 25, 2024
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!
grunweg
force-pushed
the
MR-rewrite-more-style-linters
branch
from
May 25, 2024 11:45
d61b18a
to
18e9c21
Compare
I filed #13240 for rewriting the copyright check. |
avoiding some array-to-list conversion.
The current implementation is too slow, though --- is this the process spawning?
…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.
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.)
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.
grunweg
changed the title
wip: rewrite most style linters in Lean
[Tracking PR] feat: rewrite most style linters in Lean
May 29, 2024
leanprover-community-mathlib4-bot
added
the
merge-conflict
The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot)
label
May 31, 2024
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
leanprover-community-mathlib4-bot
removed
the
blocked-by-other-PR
This PR depends on another PR to Mathlib (this label is automatically managed by a bot)
label
Jun 30, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
merge-conflict
The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot)
t-linter
Linter
tech debt
Tracking cross-cutting technical debt, see e.g. the "Technical debt counters" stream on zulip
WIP
Work in progress
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.py
in Lean.Steps for landing this:
lint_style
executable to thescripts
directory #14057, to move the executable out ofMathlib/Tactic
update-style-exceptions
in Lean #14273, rewriting the updating of style exceptions in Leanprofiler
option #14006IO.FS.lines
method 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_style
executable into the build workflow; works nicelyupdate_style_exceptions
executable; this can run both the python script and the Lean linter (not implemented yet).