Created
August 31, 2020 20:43
-
-
Save notmatthancock/ee81a5855b48c98699cbf7fe1df9fd82 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 only on new files according to git-diff | |
# | |
# If run with no arguments, i.e., | |
# $ dflake8 | |
# then the diff is taken against the master branch. | |
# If run with a single argument, then that argument is used for diff'ing, i.e., | |
# $ dflake8 feature-branch | |
# or | |
# $ dflake8 HEAD | |
dflake8 () { | |
if [ -n "$1" ] | |
then | |
commit=$1 | |
else | |
commit=master | |
fi | |
echo Using \"$commit\" as base for \'diff\' | |
git diff --name-only --diff-filter=AM $commit '***.py' \ | |
| xargs --no-run-if-empty -t flake8 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment