-
-
Save muke5hy/8259cffe13411dc3d199bca2c8d6debd to your computer and use it in GitHub Desktop.
PEP8 compliance pre-commit git hook
This file contains hidden or 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