Last active
July 25, 2016 14:20
-
-
Save breard-r/f34b68778e6753c87022 to your computer and use it in GitHub Desktop.
PEP8 compliance pre-commit git hook
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/sh | |
# Inline version: | |
# find . -wholename "./*/migrations" -prune -o -wholename "./docs/*" -prune -o -name "*\.py" -exec pep8 {} \; | |
final_exit=0 | |
for file in $(find . -wholename "./*/migrations" -prune -o -wholename "./docs/*" -prune -o -name "*\.py" -print); do | |
pep8 "$file" | |
if [ $? -ne 0 ]; then | |
final_exit=1 | |
fi | |
done | |
if [ $final_exit -ne 0 ]; then | |
echo "PEP8 compliance test failed, aborting commit." | |
fi | |
exit $final_exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment