Created
December 7, 2011 06:36
-
-
Save tkaemming/1441732 to your computer and use it in GitHub Desktop.
bash pre-commit script to run pyflakes and pep8 checks
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
#!/bin/bash | |
ERROR_LIST=$(find . -name \*.py -not -path \*migrations/\* -not -path \*settings/\* -not -path \*vendor/\* -not -path \*node_modules/\* | xargs pyflakes) | |
RETVAL=$? | |
if [[ $RETVAL -ne 0 ]]; then | |
echo "Encountered errors during pyflakes check, cowardly refusing to commit." | |
echo "$ERROR_LIST" | |
exit $RETVAL | |
fi | |
ERROR_LIST="$(pep8 -r --show-source --ignore=W391 --exclude=migrations/,vendor/,node_modules/ .)" | |
RETVAL=$? | |
if [[ $RETVAL -ne 0 ]]; then | |
echo "Encountered errors during PEP8 style check, cowardly refusing to commit." | |
echo "$ERROR_LIST" | |
exit 1 | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment