Browse Source

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
tags/2.0.0.0b3
Tom Barron 3 years ago
parent
commit
334e08121c
2 changed files with 19 additions and 0 deletions
  1. 15
    0
      tools/fast8.sh
  2. 4
    0
      tox.ini

+ 15
- 0
tools/fast8.sh View File

@@ -0,0 +1,15 @@
1
+#!/bin/bash
2
+
3
+cd $(dirname "$0")/..
4
+CHANGED=$(git diff --name-only HEAD~1 | tr '\n' ' ')
5
+
6
+# Skip files that don't exist
7
+# (have been git rm'd)
8
+CHECK=""
9
+for FILE in $CHANGED; do
10
+    if [ -f "$FILE" ]; then
11
+        CHECK="$CHECK $FILE"
12
+    fi
13
+done
14
+
15
+diff -u --from-file /dev/null $CHECK | flake8 --diff

+ 4
- 0
tox.ini View File

@@ -55,6 +55,10 @@ commands = python setup.py build_sphinx
55 55
 [testenv:cover]
56 56
 commands = {toxinidir}/tools/cover.sh {posargs}
57 57
 
58
+[testenv:fast8]
59
+commands =
60
+  {toxinidir}/tools/fast8.sh
61
+
58 62
 [testenv:pylint]
59 63
 deps = -r{toxinidir}/requirements.txt
60 64
        pylint==0.26.0

Loading…
Cancel
Save