Created
August 19, 2016 10:42
-
-
Save openrijal/62a3a187c39751b3cf6d2c976d3ccca4 to your computer and use it in GitHub Desktop.
shell script to run pyflakes on all python files in a git diff
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 | |
PYFLAKES=$(which pyflakes) | |
GIT=$(which git) | |
BRANCH=$($GIT rev-parse --abbrev-ref HEAD) | |
if [ $# -eq 0 ] | |
then | |
echo "No arguments supplied, please provide atleast 1 branch or commit hash. SYNTAX: difflakes [src] [dst]" | |
exit; | |
fi | |
if [ "$1" != "master" ]; then | |
A=$1 | |
else | |
A='master' | |
fi | |
if [ -z "$2" ]; then | |
B=$BRANCH | |
else | |
B=$2 | |
fi | |
echo "running pyflakes on diff between $A and $B" | |
pyflakes $(git diff $A..$B --name-only | grep \.py$) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment