Skip to content

Instantly share code, notes, and snippets.

@leepa
Created March 29, 2012 08:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leepa/2234934 to your computer and use it in GitHub Desktop.
Save leepa/2234934 to your computer and use it in GitHub Desktop.
# 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