Skip to content

feat: prettier output on style errors#13623

Closed
grunweg wants to merge 22 commits intomasterfrom
MR-prettier-file-length-errors
Closed

feat: prettier output on style errors#13623
grunweg wants to merge 22 commits intomasterfrom
MR-prettier-file-length-errors

Conversation

@grunweg
Copy link
Copy Markdown
Contributor

@grunweg grunweg commented Jun 7, 2024

Produce prettier output on errors for the Lean style linter:

  • by default, produce error messages which are human-readable and clickable (not the goop for github's matchers); output suitable for github matchers is added as an option
  • allow linting a list of files (as well as everything: just specify no files)
  • add an --update flag to just add exceptions for all current errors

On top of this, re-implements the update_style_exceptions script in Lean, as lean exe lint_style --regenerate. As long as there are Python style linters, this calls into the Python linters to update the output.
When the dependent PR lands, this will be split into a follow-up.
Likewise, just re-ordering the style exceptions could be split into its own PR as well.


This only covers the text-based linter in Lean, sorry: if you crave for better errors, you can help by reviewing my PRs to rewrite the Python lints in Lean :-)
Feedback on naming the flag is welcome: for instance, is --ignore (matching shake) better than --update?

This has the side effect of re-ordering the existing style exceptions: now, they are (essentially) sorted by error type first.
I'd argue this is more useful in practice. If you want me to split this re-ordering into a separate PR, I can do so.

Open in Gitpod

@grunweg grunweg added WIP Work in progress t-linter Linter labels Jun 7, 2024
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jun 7, 2024

PR summary ca235292b4

Import changes

No significant changes to the import graph


Declarations diff

No declarations were harmed in the making of this PR! 🐙

You can run this locally as follows
## summary with just the declaration names:
./scripts/no_lost_declarations.sh short <optional_commit>

## more verbose report:
./scripts/no_lost_declarations.sh <optional_commit>

@grunweg grunweg force-pushed the MR-prettier-file-length-errors branch from 85d815a to c5d47b4 Compare June 8, 2024 09:23
@grunweg grunweg added awaiting-review and removed WIP Work in progress labels Jun 8, 2024
@ghost ghost added the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Jun 8, 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 Jun 9, 2024
grunweg added 16 commits June 15, 2024 11:46
As all module names do not contain path separators, splitting on file paths
is actually fine :-)
thus, we *could* error on invalid lines, in principle.
Add a --github flag (false by default): if true, the script produces
errors wrappable by the github matchers, but if false, it produces
human-readable and clickable output!
This means a separate mode variable is not necessary: yay for proper
inductive types; these are amazing!
If none are specified, all files are linted.
@grunweg grunweg force-pushed the MR-prettier-file-length-errors branch from 037fe17 to fa3ee22 Compare June 15, 2024 10:14
@grunweg grunweg removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jun 15, 2024
@grunweg grunweg force-pushed the MR-prettier-file-length-errors branch from de13713 to 7ad105d Compare June 15, 2024 14:19
grunweg added 2 commits June 15, 2024 16:39
…tions

and replace the contents of style-exceptions by the new output.

Call the Python linter with an external shell script, which is simpler than
update-style-exceptions.py.

Replace all uses of update-style-exceptions by lake exe lint_style --regenerate.
@grunweg grunweg force-pushed the MR-prettier-file-length-errors branch from 7ad105d to 36d4ea1 Compare June 15, 2024 14:43
@ghost ghost added merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) and removed blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) labels Jun 19, 2024
@ghost
Copy link
Copy Markdown

ghost commented Jun 23, 2024

Merge branch 'master' into MR-prettier-file-length-errors
@ghost ghost added merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) and removed merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) labels Jun 23, 2024
@grunweg
Copy link
Copy Markdown
Contributor Author

grunweg commented Aug 2, 2024

This has been implemented now (except for just linting individual files, which can be added later). Closing.

@grunweg grunweg closed this Aug 2, 2024
@grunweg grunweg deleted the MR-prettier-file-length-errors branch August 2, 2024 10:02
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants