Last active
September 15, 2020 05:38
-
-
Save millerdev/e25014e4b886a5c619419d56b778a423 to your computer and use it in GitHub Desktop.
Run fake8 on lines changed in current branch
This file contains hidden or 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 | |
# https://gist.github.com/millerdev/e25014e4b886a5c619419d56b778a423 | |
# | |
# Usage: git flake8 [refname] [flake8 options] | |
if [ "${1:0:1}" = "-" ]; then | |
BRANCH=origin/master | |
else | |
BRANCH=${1:-origin/master} | |
shift | |
fi | |
CURRENT=$(git rev-parse --abbrev-ref HEAD) | |
echo "$BRANCH...$CURRENT" | |
git diff $BRANCH...$CURRENT | flake8 --diff "$@" 1>&2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Copy this script to a directory in
$PATH
and make the file executable (chmod +x git-flake8
). flake8 must be installed and accessible via$PATH
as well (a virtualenv is a great place to put that).