Created
June 26, 2014 15:37
-
-
Save ssanderson/04aed4d45c8d6d34c091 to your computer and use it in GitHub Desktop.
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
# Run flake8 against any added/modified python files in the current git repo. | |
function check8 () | |
{ | |
errors=`git diff --relative --name-only --diff-filter AM --ignore-submodules | grep -e "\.py" | xargs flake8` | |
retval=$? | |
# xargs returns 127 if flake8 couldn't be found | |
if [ "$retval" = "127" ] | |
then | |
echo "Failed to find flake8. Check your virtualenv?" | |
return 127 | |
elif [ "$retval" != "0" ] | |
then | |
echo "Errors Found:" | |
echo "${errors}" | |
return "$retval" | |
else | |
echo "No errors found." | |
return 0 | |
fi | |
# If errors is not empty | |
if [ ! -z "$errors" ] | |
then | |
echo "Errors Found:" | |
echo "a${errors}b" | |
return 1 | |
else | |
echo "No errors found." | |
return 0 | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment