From 634e513d62655588d9bdfc39fa64001c4e3c72de Mon Sep 17 00:00:00 2001 From: Al Bailey Date: Tue, 18 Dec 2018 10:59:21 -0600 Subject: [PATCH] Properly enable hacking checks for flake8 hacking and flake8 have compatability issues. By specifying the version of hacking to be the same as what other openstack components are using, we clamp the version of flake8 and allow for reliable hacking checks. Change-Id: I8ab1543c030439903d99fffec1a9e3a264f20a80 Story: 2004515 Task: 28571 Signed-off-by: Al Bailey --- .../configutilities/test-requirements.txt | 4 +++ configutilities/configutilities/tox.ini | 12 ++++---- .../controllerconfig/test-requirements.txt | 3 +- controllerconfig/controllerconfig/tox.ini | 9 +++--- sysinv/sysinv/sysinv/test-requirements.txt | 3 +- sysinv/sysinv/sysinv/tox.ini | 29 +++++++++++-------- test-requirements.txt | 1 + tox.ini | 5 ++-- 8 files changed, 36 insertions(+), 30 deletions(-) create mode 100644 configutilities/configutilities/test-requirements.txt diff --git a/configutilities/configutilities/test-requirements.txt b/configutilities/configutilities/test-requirements.txt new file mode 100644 index 0000000000..e069914668 --- /dev/null +++ b/configutilities/configutilities/test-requirements.txt @@ -0,0 +1,4 @@ +# The order of packages is significant, because pip processes them in the order +# of appearance. Changing the order has an impact on the overall integration +# process, which may cause wedges in the gate later. +hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0 diff --git a/configutilities/configutilities/tox.ini b/configutilities/configutilities/tox.ini index fd39d6c86b..2f207dcb03 100644 --- a/configutilities/configutilities/tox.ini +++ b/configutilities/configutilities/tox.ini @@ -7,7 +7,6 @@ envlist = flake8 # Tox does not work if the path to the workdir is too long, so move it to /tmp toxworkdir = /tmp/{env:USER}_ccutiltox -wrsdir = {toxinidir}/../../../../../../../../.. [testenv] whitelist_externals = find @@ -18,20 +17,19 @@ commands = {posargs} [testenv:flake8] basepython = python2.7 -deps = hacking - flake8<3.6.0 +deps = -r{toxinidir}/test-requirements.txt commands = flake8 {posargs} +# hacking pulls in flake8 2.5.5 which does not support parsing multi-line ignore list # H series are hacking # H102: Apache 2.0 license header not found # H104: File contains nothing but comments # H301: one import per line -# H306: imports not in alphabetical order +# H306: imports not in alphabetical order # H401: docstring should not start with a space # H403: multi line docstrings should end on a new line # H404: multi line docstring should start without a leading new line # H405: multi line docstring summary not separated with an empty line -# W503 line break before binary operator [flake8] -ignore = H102,H104,H301,H306,H401,H403,H404,H405, - W503 +ignore = H102,H104,H301,H306,H401,H403,H404,H405 +exclude = dist diff --git a/controllerconfig/controllerconfig/test-requirements.txt b/controllerconfig/controllerconfig/test-requirements.txt index 681321cf13..674c83a8df 100644 --- a/controllerconfig/controllerconfig/test-requirements.txt +++ b/controllerconfig/controllerconfig/test-requirements.txt @@ -1,4 +1,5 @@ -pylint <=1.9.3;python_version<'3.0' +hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0 +pylint <=1.9.3;python_version<'3.0' pytest mock coverage>=3.6 diff --git a/controllerconfig/controllerconfig/tox.ini b/controllerconfig/controllerconfig/tox.ini index 196df4bb8a..96097923a8 100644 --- a/controllerconfig/controllerconfig/tox.ini +++ b/controllerconfig/controllerconfig/tox.ini @@ -30,8 +30,7 @@ commands = pylint {posargs} controllerconfig --rcfile=./pylint.rc --extension-pk [testenv:flake8] basepython = python2.7 -deps = hacking - flake8<3.6.0 +deps = -r{toxinidir}/test-requirements.txt commands = flake8 {posargs} [flake8] @@ -47,8 +46,8 @@ commands = flake8 {posargs} # H403: multi line docstrings should end on a new line # H404: multi line docstring should start without a leading new line # H405: multi line docstring summary not separated with an empty line -ignore = H101,H102,H104,H232,H238,H301,H306,H401,H403,H404,H405, - W503 +ignore = H101,H102,H104,H232,H238,H301,H306,H401,H403,H404,H405 +exclude = build [testenv:py27] basepython = python2.7 @@ -59,7 +58,7 @@ commands = [testenv:cover] basepython = python2.7 deps = {[testenv]deps} - + commands = coverage erase python setup.py testr --coverage --testr-args='{posargs}' diff --git a/sysinv/sysinv/sysinv/test-requirements.txt b/sysinv/sysinv/sysinv/test-requirements.txt index 1cdb7c7a7f..4990bf5ab3 100644 --- a/sysinv/sysinv/sysinv/test-requirements.txt +++ b/sysinv/sysinv/sysinv/test-requirements.txt @@ -1,8 +1,7 @@ # The order of packages is significant, because pip processes them in the order # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. - -hacking<0.11,>=0.10.0 +hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0 coverage>=3.6 discover fixtures>=0.3.14 diff --git a/sysinv/sysinv/sysinv/tox.ini b/sysinv/sysinv/sysinv/tox.ini index db2dc029fb..bf18d45b01 100644 --- a/sysinv/sysinv/sysinv/tox.ini +++ b/sysinv/sysinv/sysinv/tox.ini @@ -48,10 +48,13 @@ deps = -r{toxinidir}/requirements.txt commands = find . -type f -name "*.pyc" -delete +[flake8] +# Note: hacking pulls in flake8 2.5.5 which can not parse an ignore list spanning multiple lines # E series are pep8 # E126 continuation line over-indented for hanging indent # E127 continuation line over-indented for visual indent # E128 continuation line under-indented for visual indent +# E226 missing whitespace around arithmetic operator # E402 module level import not at top of file # E501 line too long > 80 # H series are hacking @@ -59,21 +62,23 @@ commands = # H102 is apache license # H104 file contains only comments (ie: license) # H105 author tags -# H231..H238 are python3 compatability -# H301: one import per line -# H306: imports not in alphabetical order -# H401,H403,H404,H405 are docstring and not important -# H501: Do not use self.__dict__ for string formatting -[flake8] -ignore = E126,E127,E128,E402,E501, - H101,H102,H104,H105,H232,H234,H235,H236,H237,H238, - H301,H306,H401,H403,H404,H405,H501 -builtins = _ +# H232..H238 are python3 compatability +# H301 one import per line +# H306 imports not in alphabetical order +# H401 docstring should not start with a space +# H403 multi line docstrings should end on a new line +# H404 multi line docstring should start without a leading new line +# H405 multi line docstring summary not separated with an empty line +# H501 Do not use self.__dict__ for string formatting +# H701 Empty localization string +# H702 Formatting operation should be outside of localization method call +# H703 Multiple positional placeholders +ignore = E126,E127,E128,E226,E402,E501,H101,H102,H104,H105,H232,H234,H235,H236,H237,H238,H301,H306,H401,H403,H404,H405,H501,H701,H702,H703 +exclude = build,dist [testenv:flake8] basepython = python2.7 -deps = hacking - flake8<3.6.0 +deps = -r{toxinidir}/test-requirements.txt commands = flake8 {posargs} . \ sysinv/cmd/manage-partitions \ diff --git a/test-requirements.txt b/test-requirements.txt index 47d1aec21d..402377d7a1 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,3 +1,4 @@ +hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0 bashate >= 0.2 PyYAML >= 3.1.0 yamllint >= 0.5.2 diff --git a/tox.ini b/tox.ini index a8d9c7fbfb..6bb7a2cf50 100644 --- a/tox.ini +++ b/tox.ini @@ -41,10 +41,9 @@ commands = basepython = python3 usedevelop = False skip_install = True -deps = - pep8 +deps = -r{toxinidir}/test-requirements.txt commands = - pep8 + flake8 [testenv:venv] basepython = python3