Last active
December 9, 2019 20:13
-
-
Save Ddedalus/1d561af72bd4afb1b7fec3dd2119c610 to your computer and use it in GitHub Desktop.
Run black and flake8 before each commit. Error on flake8 error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
# Pre commit hook | |
# autoformat | |
black -q . | |
# lint | |
flake_out="$(flake8 .)" | |
flake_code=$? | |
if [ $flake_code -ne 0 ] | |
then | |
echo "Pre-commit hook: flake8 exited with code $flake_code" | |
echo "$flake_out" | |
exit $flake_out | |
fi | |
exit 0 | |
# Note: config for black and flake8 can be passed through relevant config files in the root directory of the repository |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment