Use pre-commit package to do codestyle CI checks#9890
Conversation
|
Just to make sure I understand how this works, how does git know about this pre-commit hook? |
| pre-commit | ||
| commands = | ||
| pre-commit install-hooks | ||
| pre-commit run --all-files |
There was a problem hiding this comment.
couldn't this be the other way around, for pre-commit to run the tox command?
E.g. looking into the tox config is more intuitive thing to do to look for the exact error codes than yet at another place.
There was a problem hiding this comment.
I agree, is there any way to switch this around?
There was a problem hiding this comment.
That certainly doesn't work out of the box. Also pre-commit comes with a load of other checks plugins other than flake8, so it's a simple way to configure multiple checks.
If you want to teach git about it you can run you have to do this for each checkout you want to run the pre-commit for (git limitation). |
e2554f8 to
68d71cc
Compare
|
Not release-critical, so removing milestone |
|
Hi humans 👋 - this pull request hasn't had any new commits for approximately 5 months. I plan to close this in a month if the pull request doesn't have any new commits by then. In lieu of a stalled pull request, please consider closing this and open an issue instead if a reminder is needed to revisit in the future. Maintainers may also choose to add If this PR still needs to be reviewed, as an author, you can rebase it to reset the clock. If you believe I commented on this pull request incorrectly, please report this here. |
|
@Cadair How can I help get this restarted / in ? |
The objective of this PR is to suggest a solution to the problem discussed at the coordination meeting of how can we make it easy for people to ensure that their code is conformant to the CIs enforcement of the style before they push.
This does two things:
codestyletox env.Using the pre-commit hooks locally as a git pre-commit is entirely optional, but doing so means you will always pass that CI build. If you don't want the git commit but want to check your code if conformant, you can run
pre-commit run --all-files.Also, I enabled a bunch of extra style checks, like trailing whitespace and blank lines at end of files etc. Fixing these is the large part of this diff.