diff --git a/scripts/git_hooks/pre-commit b/scripts/git_hooks/pre-commit new file mode 100755 index 0000000..cf115a9 --- /dev/null +++ b/scripts/git_hooks/pre-commit @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +# +# Call black and flake before each commit. +# The command "git commit" with no argument will trigger this script. +# +# To enable this hook, cp this file to .git/hooks/. + +# If any command fails, exit immediately with that command's exit status +set -eo pipefail + +# Run black against all code in the `source_code` directory +black . --check +echo "-------> Black passed!" + +# Run isort against all code in the `source_code` directory +isort . -c +echo "-------> Isort passed!" + +# Run flake8 against all code in the `source_code` directory +flake8 . +echo "-------> Flake8 passed!" + +# Run mypy against all code in the `source_code` directory +mypy . +echo "-------> Mypy passed!" +