Pre-commit is a python package that helps prevent wrong code getting into a commit. It automates the checking such that small bugs are caught early. It can also be customised!
To install precommit, run the following in a virtualenv (and while in a git repo).
pip install pre-commit
You can confirm everything is installed by running;
To generate a new settings file locally, you need to run;
pre-commit sample-config > .pre-commit-config.yaml
Don't forget to install the hooks.
Now you're ready to run the hook.
Feedback? See an issue? Feel free to mention it here.
If you want to be kept up to date, consider getting the newsletter.