Skip to content

[Tracking PR] feat: rewrite most style linters in Lean#13199

Closed
grunweg wants to merge 64 commits intomasterfrom
MR-rewrite-more-style-linters
Closed

[Tracking PR] feat: rewrite most style linters in Lean#13199
grunweg wants to merge 64 commits intomasterfrom
MR-rewrite-more-style-linters

Conversation

@grunweg
Copy link
Copy Markdown
Contributor

@grunweg grunweg commented May 25, 2024

This is tracking PR for rewriting most linters in lint-style.py in Lean.


Steps for landing this:

Open in Gitpod

grunweg added 19 commits May 25, 2024 09:53
Unlike the Python version, this script also supports set_option tactics
and terms.
…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 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
@ghost ghost added the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label May 25, 2024
grunweg added 3 commits May 25, 2024 13:36
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 grunweg force-pushed the MR-rewrite-more-style-linters branch from d61b18a to 18e9c21 Compare May 25, 2024 11:45
…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.
@grunweg
Copy link
Copy Markdown
Contributor Author

grunweg commented May 26, 2024

As a way to roll this out, I have rewritten update_style_exceptions.sh as a Lean executable: this allows both linters to co-exist.

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.)
@grunweg
Copy link
Copy Markdown
Contributor Author

grunweg commented May 26, 2024

Compiling the linter to an executable makes it much faster: now it's an order of magnitude faster than the Python linter.

@grunweg grunweg changed the title wip: rewrite most style linters in Lean [Tracking PR] feat: rewrite most style linters in Lean May 29, 2024
@ghost ghost 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
@ghost ghost removed the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Jun 30, 2024
@joneugster joneugster added the WIP Work in progress label Sep 12, 2024
@joneugster joneugster marked this pull request as draft September 12, 2024 07:43
@grunweg
Copy link
Copy Markdown
Contributor Author

grunweg commented Feb 16, 2025

I think this PR has served its purpose; closing.

@grunweg grunweg closed this Feb 16, 2025
@grunweg grunweg deleted the MR-rewrite-more-style-linters branch February 16, 2025 09:34
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants