Created
March 29, 2012 08:19
-
-
Save leepa/2234934 to your computer and use it in GitHub Desktop.
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
# Put me in .git/hooks/pre-commit for any Django projects you work on | |
# Make sure you have flake8 installed globally via 'pip install flake8' | |
ret_code=0 | |
for file in $(git diff --name-only --cached $against) | |
do | |
if [ ! -z "$(grep 'DEBUGS' $file)" ] | |
then | |
echo "DEBUGS in file $file" | |
ret_code=1 | |
fi | |
if [ "${file##*.}" == "py" ] | |
then | |
flake8 $file | |
if [ $? != 0 ] | |
then | |
ret_code=1 | |
fi | |
fi | |
done | |
exit $ret_code |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment