Skip to content

Instantly share code, notes, and snippets.

@aturley
Created June 20, 2012 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aturley/2960286 to your computer and use it in GitHub Desktop.
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.
#!/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