Skip to content

Instantly share code, notes, and snippets.

@brunobord
Created June 29, 2016 07:27
Show Gist options
  • Save brunobord/62770144536e031ec86823c6a755927c to your computer and use it in GitHub Desktop.
Save brunobord/62770144536e031ec86823c6a755927c to your computer and use it in GitHub Desktop.
Pre commit hook ; flake8 on all python files only
#!/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