Enable fast8 check
Fast8 only check these files that changed, which is more efficient for tox test. Change-Id: I9a9816e12361900261fa2ee693bf211154eb2e0f
This commit is contained in:
parent
dea080a5d4
commit
4fa99dd51d
28
tools/flake8wrap.sh
Normal file
28
tools/flake8wrap.sh
Normal file
@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# A simple wrapper around flake8 which makes it possible
|
||||
# to ask it to only verify files changed in the current
|
||||
# git HEAD patch.
|
||||
#
|
||||
# Intended to be invoked via tox:
|
||||
#
|
||||
# tox -epep8 -- -HEAD
|
||||
#
|
||||
|
||||
if test "x$1" = "x-HEAD" ; then
|
||||
shift
|
||||
files=$(git diff --name-only HEAD~1 | tr '\n' ' ')
|
||||
echo "Running flake8 on ${files}"
|
||||
echo ""
|
||||
echo "Consider using the 'pre-commit' tool instead."
|
||||
echo ""
|
||||
echo " pip install --user pre-commit"
|
||||
echo " pre-commit install --allow-missing-config"
|
||||
echo ""
|
||||
diff -u --from-file /dev/null ${files} | flake8 --diff "$@"
|
||||
else
|
||||
echo "Running flake8 on all files"
|
||||
echo ""
|
||||
exec flake8 "$@"
|
||||
fi
|
||||
|
13
tox.ini
13
tox.ini
@ -10,6 +10,12 @@ basepython = python3
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
OS_TEST_PATH=venus/tests/unit
|
||||
usedevelop = True
|
||||
allowlist_externals =
|
||||
bash
|
||||
find
|
||||
rm
|
||||
env
|
||||
make
|
||||
install_command = pip install {opts} {packages}
|
||||
|
||||
deps =
|
||||
@ -30,6 +36,13 @@ commands =
|
||||
# Check that .po and .pot files are valid:
|
||||
doc8 --ignore D001 doc/source/ CONTRIBUTING.rst HACKING.rst README.rst
|
||||
|
||||
[testenv:fast8]
|
||||
description =
|
||||
Run style checks on the changes made since HEAD~. For a full run including docs, use 'pep8'
|
||||
envdir = {toxworkdir}/shared
|
||||
commands =
|
||||
bash tools/flake8wrap.sh -HEAD
|
||||
|
||||
[testenv:venv]
|
||||
commands = {posargs}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user