Add new tox env to check for pep8 issues 06/111306/2
authorkrishnaa96 <krishna.moorthy6@wipro.com>
Sun, 16 Aug 2020 13:37:09 +0000 (19:07 +0530)
committerkrishnaa96 <krishna.moorthy6@wipro.com>
Mon, 17 Aug 2020 06:00:35 +0000 (11:30 +0530)
The linter will check for issues in new and updated
files for a new commit

Issue-ID: OPTFRA-837
Signed-off-by: krishnaa96 <krishna.moorthy6@wipro.com>
Change-Id: Id0759380475f5360c340abb71cd0afe0761beac8

conductor/tox.ini

index e358564..3fe867a 100644 (file)
@@ -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