Skip to content
Christine Vinaviles edited this page Oct 5, 2018 · 1 revision

What is pre-commit?

pre-commit does some syntax and code quality checks for code style, flake8 and pylint. When it can, pre-commit will correct those files for you.

To install:

sudo -H pip install pre-commit --user --no-warn-script-location
pre-commit install -f --install-hooks

To use, simply run:

$ git add {files that were modified by pre-commit}
$ git commit -m "happy days"
... checks happen ...

If it's a pylint error etc. fix up the files ...

$ git add [changes to files it identified as non-compliant]
$ git commit -m "happy days"
$ git push

Note: You will need to re-add any files that pre-commit fixes up for you. If there weren't any and it passed everything then you may commit what your original staged files

Clone this wiki locally