We use git pre-commit hooks to check that files going to be committed:
- contain no trailing spaces
- are formatted with black
- are compatible to PEP8 (checked by flake8)
- end in a newline and only a newline
- contain sorted
imports
(checked by isort)
These hooks are disabled by default. Please use the following commands to enable them:
pip install pre-commit # run it only once
pre-commit install # run it only once, it will install all hooks
# modify some files
git add <some files>
git commit # It runs all hooks automatically.
# If all hooks run successfully, you can write the commit message now. Done!
#
# If any hook failed, your commit was not successful.
# Please read the error messages and make changes accordingly.
# And rerun
git add <some files>
git commit