Created
June 20, 2012 14:55
-
-
Save aturley/2960286 to your computer and use it in GitHub Desktop.
Run pep8 and pylint on all of the new and modified Python files in a git repo.
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/bash | |
if [ -z "$(which pep8)" ]; | |
then | |
echo "Could not find pep8" | |
exit 1 | |
fi | |
if [ -z "$(which pylint)" ]; | |
then | |
echo "Could not find pylint" | |
exit 1 | |
fi | |
exit_code=0; | |
for checkable in $(git status -s | sed -n 's/^...\(.*\.py\)/\1/p') | |
do | |
pylint --reports=n $checkable 2> /dev/null | |
echo $((exit_code+=$?)) > /dev/null | |
pep8 $checkable | |
echo $((exit_code+=$?)) > /dev/null | |
done | |
exit $exit_code |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment