Zulip Chat Archive
Stream: new members
Topic: Check Lint without making a commit
Josha Dekker (Dec 21 2023 at 12:29):
I've recently made a PR to Mathlib, but find that the 'Lint style' check tends to find several mistakes in my formatting. Is there a way to automatically this check prior to committing, so I don't have a whole list of commits of the type "style : fixed a small lint mistake"?
Pedro Sánchez Terraf (Dec 21 2023 at 12:30):
You can put #lint
at the end of the file, that'll catch several errors
Pedro Sánchez Terraf (Dec 21 2023 at 12:31):
But I'm not certain it is complete. Perhaps there are some arguments you can pass to it.
Yaël Dillies (Dec 21 2023 at 12:32):
#lint
explicitly does not check for style
Josha Dekker (Dec 21 2023 at 12:36):
#lint did find an unnecessary "have" that I could get rid of, so that is nice as well! Is there a similar command that does check for style?
Yaël Dillies (Dec 21 2023 at 12:39):
You can Ctrl + F the regex .{101}
for long lines. There will be similar regex for other lints, but there's currently no script that does them all.
Josha Dekker (Dec 21 2023 at 12:42):
Okay, thanks!
Josha Dekker (Dec 21 2023 at 12:42):
Is there some other way to commit -> revise -> remove the old commit, so that they don't stack up so quickly?
Yaël Dillies (Dec 21 2023 at 12:45):
You can always "rebase". But I wouldn't worry about it. All commits on your PR will get squashed by bors when merged to master.
Josha Dekker (Dec 21 2023 at 12:47):
Okay, great! Thanks!
Alex J. Best (Dec 21 2023 at 13:46):
You can run the style linters by running the script scripts/lint-style.sh
. For an added bonus you can run scripts/lint-style.sh --fix
which will automatically fix some issues but not all
Last updated: May 02 2025 at 03:31 UTC