Skip to content

Instantly share code, notes, and snippets.

@graeme-winter
Created June 7, 2019 08:40
Show Gist options
  • Save graeme-winter/579fd11893fb8d85a310faf7e5df2c1a to your computer and use it in GitHub Desktop.
Save graeme-winter/579fd11893fb8d85a310faf7e5df2c1a to your computer and use it in GitHub Desktop.
Run flake8 comparing current branch to master (ignoring Python2/3 xrange; cmp)
BRANCH=$(git branch 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
CHANGED_FILES=$(git diff --name-only master...${BRANCH} -- "*.py")
[ -z "${CHANGED_FILES}" ] && echo There are no relevant changes. Skipping test. && exit 0
echo Running flake8 on changed files:
flake8 --select=E711,E712,E713,E714,E721,E722,E901,F401,F402,F403,F632,F811,F812,F821,F822,F841,F901,W191,W602,W603,W604,W605,W606 $CHANGED_FILES | grep -v "'xrange'" | grep -v "'cmp'"
@graeme-winter
Copy link
Author

Based on travis configuration from @Anthchirp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment