Skip to content

Instantly share code, notes, and snippets.

@kevinjqiu
Created September 11, 2012 14:37
Show Gist options
  • Save kevinjqiu/3699196 to your computer and use it in GitHub Desktop.
Save kevinjqiu/3699196 to your computer and use it in GitHub Desktop.
#! /bin/bash
current_branch=$(git symbolic-ref -q HEAD | cut -d'/' -f3)
files_changed=$(git diff --name-only $current_branch master | grep -e "\.py$")
if [ -e "$files_changed" ]; then
echo "No python code was changed. Exiting..."
exit 0
else
for file in $files_changed; do
git checkout master &> /dev/null
cnt1=$(pylint --rcfile=.pylintrc $file | wc -l)
git checkout $current_branch &> /dev/null
cnt2=$(pylint --rcfile=.pylintrc $file | wc -l)
if [ $cnt1 -gt $cnt2 ]; then
d="-"
elif [ $cnt1 -lt $cnt2 ]; then
d="+"
else
d="="
fi
echo "$file: $cnt1 $cnt2 $d"
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment