Skip to content

Instantly share code, notes, and snippets.

@leepa leepa/pre-commit
Created Mar 29, 2012

Embed
What would you like to do?
# 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
You can’t perform that action at this time.