From 334e08121c8cf7093eb8784c09e6addbc5c6c52a Mon Sep 17 00:00:00 2001 From: Tom Barron Date: Sun, 21 Feb 2016 09:14:13 -0500 Subject: [PATCH] Add tox fast8 option This commit ports over the fast8 option from cinder, which enables one to run pep8 only on one's changeset rather than against the whole body of code via: tox -efast8 Change-Id: Icb0286c3c66983f2f106c163cb11c690b2c57849 --- tools/fast8.sh | 15 +++++++++++++++ tox.ini | 4 ++++ 2 files changed, 19 insertions(+) create mode 100755 tools/fast8.sh diff --git a/tools/fast8.sh b/tools/fast8.sh new file mode 100755 index 0000000000..2b3e22abda --- /dev/null +++ b/tools/fast8.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +cd $(dirname "$0")/.. +CHANGED=$(git diff --name-only HEAD~1 | tr '\n' ' ') + +# Skip files that don't exist +# (have been git rm'd) +CHECK="" +for FILE in $CHANGED; do + if [ -f "$FILE" ]; then + CHECK="$CHECK $FILE" + fi +done + +diff -u --from-file /dev/null $CHECK | flake8 --diff diff --git a/tox.ini b/tox.ini index 69786c861c..d1f612a652 100644 --- a/tox.ini +++ b/tox.ini @@ -55,6 +55,10 @@ commands = python setup.py build_sphinx [testenv:cover] commands = {toxinidir}/tools/cover.sh {posargs} +[testenv:fast8] +commands = + {toxinidir}/tools/fast8.sh + [testenv:pylint] deps = -r{toxinidir}/requirements.txt pylint==0.26.0