-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Split autoformatters and linters into different workflows and CI jobs #5167
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
Comments
Does it mean that the linters will run only via pre-commit instead of manually? What I liked in the original proposal when you introduced formatting was the fact that you didn't force upon users a specific workflow aka using pre-commit. I personally prefer submitting these commands manually, after I'm done and committed my code changes and then review independently any automatic changes done by flake8, black etc. |
Partially yes, but this is already true today. The following hooks cannot be run without vision/.pre-commit-config.yaml Lines 2 to 11 in 8c546f6
For everything else, you can of course also run manually. It gets a little trickier if you have formatters that cannot be installed by
Regarding |
I'm skeptical about forcing upon developers |
It basically comes down to stuff that cannot be fixed automatically, e.g.
That can't happen. If you have the hooks installed, Besides, just using the |
From personal experience the one thing that black doesn't pick up is I see value in allowing pre-commits, but I wouldn't make this mandatory either. It's just sugar on top of the more low-level tools, and I think it's important to keep them. To answer a question from @pmeier from another thread #5168 (comment)
IMHO yes, if only for educational purpose. It's important that they know what's happening under the hood, for example to resolve errors more efficiently. |
Uh oh!
There was an error while loading. Please reload this page.
Status quo
Currently we mix formatters and linters with
pre-commit
:formatters
vision/.pre-commit-config.yaml
Lines 9 to 11 in 578c154
vision/.pre-commit-config.yaml
Lines 23 to 26 in 578c154
linters
vision/.pre-commit-config.yaml
Lines 5 to 8 in 578c154
vision/.pre-commit-config.yaml
Lines 31 to 32 in 578c154
vision/.pre-commit-config.yaml
Line 37 in 578c154
In addition we have a separate CI job that lints with
mypy
vision/.circleci/config.yml
Line 298 in 578c154
Proposal
I propose we change the rationale from the two CI jobs from
pre-commit
andmypy
to code format and lint. That means, we would only keep autoformatters in ourpre-commit
configuration and move all linters to what is currently themypy
job.Pros
pre-commit
as "single source of truth" for formatting code. Currently they mentioned as "purely optional" in our contribution guide. Sincepre-commit
supports running the hooks manually, we can simply treat it as our way to bundle all autoformatters while the user does not need to know or care what exactly is run.pre-commit
, e.g. add prettier as non-code auto formatter #5158. If anyone applies code formatting throughpre-commit
anyway, that won't break any workflow.Cons
flake8
orpydocstyle
trigger very seldom anyway due to the auto-formatting. Plus, we already need to runmypy
separately.cc @seemethere
The text was updated successfully, but these errors were encountered: