Avoid erroneous commits. The pre-commit can be skipped with the
`--no-verify` option, which is not available with the post-commit.
Note that `pre-commit` doesn't run when rebase while post-commit did.
This allows to have a single script which is run by both hooks. This
scripts can also be used independently to run the CI setup locally.
Run `isort` and `black` in the hooks. Run them with the `--check` option
to not modify files which could be committed by accident.
Note that the changes in `.gitignore` are not needed as `.log` is
already excluded in the Django's section. We add those file to this
section in case `.log` is removed in the future.
Add the `scripts/setup-hooks.sh` script which sets the following hooks
up:
- The `post-commit` hook runs the linter after every `git commit`,
letting you know if there are code style or rule linter offenses you
need to fix.
- The `pre-push` hook runs the linter and the tests and block the `git
push` if they do not succeed.
This way you realise if everything is alright without the need of
sending a PR.