Skip to content

feat(tooling): Enabled local linting#1315

Merged
antonpirker merged 5 commits into
masterfrom
antonpirker/introduce-pre-commit
Feb 9, 2022
Merged

feat(tooling): Enabled local linting#1315
antonpirker merged 5 commits into
masterfrom
antonpirker/introduce-pre-commit

Conversation

@antonpirker

Copy link
Copy Markdown
Contributor

To speed up development and prevent a lot of front and back with the CI linter, I added a pre-commit hook, so before one can commit something the linting (black, flake8 and mypy) will run locally to format and lint the changed files.

@antonpirker

Copy link
Copy Markdown
Contributor Author

I added "pre-commit" to the test-requirements.txt, did not know where to put it.

@sl0thentr0py
sl0thentr0py self-requested a review January 21, 2022 13:42
@antonpirker antonpirker self-assigned this Jan 21, 2022
@sl0thentr0py

Copy link
Copy Markdown
Member

@antonpirker I'm not familiar with this tool, but why do we need this over just a normal git hook?
https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks

@antonpirker

Copy link
Copy Markdown
Contributor Author

pre-commit has a collection of ready made hooks to choose from and it is very easy to install/uninstall the hooks. So it is just for convenience and I think it is used in python projects quite frequently (at least in the project i was part of) :-)

@antonpirker
antonpirker enabled auto-merge (squash) February 9, 2022 13:43
@antonpirker
antonpirker merged commit 8df4e05 into master Feb 9, 2022
@antonpirker
antonpirker deleted the antonpirker/introduce-pre-commit branch February 9, 2022 14:14
@miketheman

Copy link
Copy Markdown
Contributor

Excellent addition!
Please consider adding https://pre-commit.ci/ so that these checks can also be automatically fixed where possible. Free for open source projects like this one!

@sl0thentr0py

Copy link
Copy Markdown
Member

@miketheman we already had an autofix step here but we removed it since it was flaky on external contributors' forked PRs. Not sure if pre-commit also works with forked PRs?

@miketheman

Copy link
Copy Markdown
Contributor

I believe it does, as I use it on some of my open source projects, and it is run when people submit pull requests from their forks.

@miketheman

Copy link
Copy Markdown
Contributor

This also makes the pre-commit.yaml the source of rule evaluation, vs having to maintain them in two spots - the pre-commit files and the tox config for GH Action.

@sl0thentr0py

Copy link
Copy Markdown
Member

ok thanks! will try it out and clean this process up a bit more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants