Skip to content

Commit 095edbc

Browse files
committed
Pep8 environment to run on delta code only
Currently tox -epep8 will run flake8 on whole code. To make this fast, flake8 support is added for only updated(delta) code. Same can be run by "tox -efast8". Change-Id: I9c55fed32ae3060c21ec278398e9e07fb4a0fe13 Implements: BP tox-pep8-diff-part-only
1 parent 56680c8 commit 095edbc

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

tools/fast8.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

tox.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ deps = -r{toxinidir}/test-requirements.txt
1111
commands = ostestr {posargs}
1212
whitelist_externals = ostestr
1313

14+
[testenv:fast8]
15+
# Use same environment directory as pep8 env to save space and install time
16+
envdir = {toxworkdir}/pep8
17+
commands =
18+
{toxinidir}/tools/fast8.sh
19+
1420
[testenv:pep8]
1521
commands =
1622
flake8

0 commit comments

Comments
 (0)