Created
June 29, 2016 07:27
-
-
Save brunobord/62770144536e031ec86823c6a755927c to your computer and use it in GitHub Desktop.
Pre commit hook ; flake8 on all python files only
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
#!/usr/bin/env bash | |
FILES=`git diff --cached --name-only | grep .py$` | |
if [ $FILES ] | |
then | |
flake8 --config=./flake8.conf $FILES | |
if [ $? != 0 ] | |
then | |
user=`whoami` | |
echo "-- Hey, $user, correct file formating before committing plz" | |
exit 1 | |
else | |
echo "flake8 OK" | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment