From 8e23179dd67da6517382369d579e62f2435d02c8 Mon Sep 17 00:00:00 2001 From: krishnaa96 Date: Sun, 16 Aug 2020 19:07:09 +0530 Subject: Add new tox env to check for pep8 issues The linter will check for issues in new and updated files for a new commit Issue-ID: OPTFRA-837 Signed-off-by: krishnaa96 Change-Id: Id0759380475f5360c340abb71cd0afe0761beac8 --- conductor/tox.ini | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'conductor/tox.ini') diff --git a/conductor/tox.ini b/conductor/tox.ini index e358564..3fe867a 100644 --- a/conductor/tox.ini +++ b/conductor/tox.ini @@ -2,7 +2,7 @@ minversion = 1.6 skipsdist = True #envlist = py35,py27,functional,pep8 -envlist = py3,pep8 +envlist = py3,pep8,pep8diff [testenv] basepython=python3 deps = -r{toxinidir}/requirements.txt @@ -44,6 +44,11 @@ deps = hacking>=2.0.0 commands = flake8 --exit-zero +[testenv:pep8diff] +deps = hacking>=2.0.0 +commands = + bash -c "files=$(git diff HEAD^ HEAD --relative --diff-filter=d --name-only | grep -E '(^conductor\/)'| grep -E '*\.py$'); if [[ -z $files ]]; then exit 0; else flake8 $files; fi" + [testenv:genconfig] commands = oslo-config-generator --config-file=etc/conductor/conductor-config-generator.conf @@ -55,9 +60,12 @@ setenv = PYTHONHASHSEED=0 commands = bash -x oslo_debug_helper {posargs} [flake8] -ignore = H301,E401,E226,E302,E41,E303,E501,E265,E125,E101,E131,E127,E306, -exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,install-guide +select = E,H,W,F +max-line-length = 119 +exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,install-guide,*/tests/* show-source = True +ignore= +per-file-ignores= [hacking] import_exceptions = conductor.common.i18n -- cgit 1.2.3-korg