Browse Source

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 <Al.Bailey@windriver.com>
changes/66/625966/5
Al Bailey 3 years ago
parent
commit
634e513d62
  1. 4
      configutilities/configutilities/test-requirements.txt
  2. 12
      configutilities/configutilities/tox.ini
  3. 3
      controllerconfig/controllerconfig/test-requirements.txt
  4. 9
      controllerconfig/controllerconfig/tox.ini
  5. 3
      sysinv/sysinv/sysinv/test-requirements.txt
  6. 29
      sysinv/sysinv/sysinv/tox.ini
  7. 1
      test-requirements.txt
  8. 5
      tox.ini

4
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

12
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

3
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

9
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}'

3
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

29
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 \

1
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

5
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

Loading…
Cancel
Save