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>
This commit is contained in:
Al Bailey 2018-12-18 10:59:21 -06:00
parent 018352bd2e
commit 634e513d62
8 changed files with 36 additions and 30 deletions

View File

@ -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

View File

@ -7,7 +7,6 @@
envlist = flake8 envlist = flake8
# Tox does not work if the path to the workdir is too long, so move it to /tmp # Tox does not work if the path to the workdir is too long, so move it to /tmp
toxworkdir = /tmp/{env:USER}_ccutiltox toxworkdir = /tmp/{env:USER}_ccutiltox
wrsdir = {toxinidir}/../../../../../../../../..
[testenv] [testenv]
whitelist_externals = find whitelist_externals = find
@ -18,10 +17,10 @@ commands = {posargs}
[testenv:flake8] [testenv:flake8]
basepython = python2.7 basepython = python2.7
deps = hacking deps = -r{toxinidir}/test-requirements.txt
flake8<3.6.0
commands = flake8 {posargs} commands = flake8 {posargs}
# hacking pulls in flake8 2.5.5 which does not support parsing multi-line ignore list
# H series are hacking # H series are hacking
# H102: Apache 2.0 license header not found # H102: Apache 2.0 license header not found
# H104: File contains nothing but comments # H104: File contains nothing but comments
@ -31,7 +30,6 @@ commands = flake8 {posargs}
# H403: multi line docstrings should end on a new line # H403: multi line docstrings should end on a new line
# H404: multi line docstring should start without a leading new line # H404: multi line docstring should start without a leading new line
# H405: multi line docstring summary not separated with an empty line # H405: multi line docstring summary not separated with an empty line
# W503 line break before binary operator
[flake8] [flake8]
ignore = H102,H104,H301,H306,H401,H403,H404,H405, ignore = H102,H104,H301,H306,H401,H403,H404,H405
W503 exclude = dist

View File

@ -1,3 +1,4 @@
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
pylint <=1.9.3;python_version<'3.0' pylint <=1.9.3;python_version<'3.0'
pytest pytest
mock mock

View File

@ -30,8 +30,7 @@ commands = pylint {posargs} controllerconfig --rcfile=./pylint.rc --extension-pk
[testenv:flake8] [testenv:flake8]
basepython = python2.7 basepython = python2.7
deps = hacking deps = -r{toxinidir}/test-requirements.txt
flake8<3.6.0
commands = flake8 {posargs} commands = flake8 {posargs}
[flake8] [flake8]
@ -47,8 +46,8 @@ commands = flake8 {posargs}
# H403: multi line docstrings should end on a new line # H403: multi line docstrings should end on a new line
# H404: multi line docstring should start without a leading new line # H404: multi line docstring should start without a leading new line
# H405: multi line docstring summary not separated with an empty line # H405: multi line docstring summary not separated with an empty line
ignore = H101,H102,H104,H232,H238,H301,H306,H401,H403,H404,H405, ignore = H101,H102,H104,H232,H238,H301,H306,H401,H403,H404,H405
W503 exclude = build
[testenv:py27] [testenv:py27]
basepython = python2.7 basepython = python2.7

View File

@ -1,8 +1,7 @@
# The order of packages is significant, because pip processes them in the order # 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 # of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later. # process, which may cause wedges in the gate later.
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
hacking<0.11,>=0.10.0
coverage>=3.6 coverage>=3.6
discover discover
fixtures>=0.3.14 fixtures>=0.3.14

View File

@ -48,10 +48,13 @@ deps = -r{toxinidir}/requirements.txt
commands = commands =
find . -type f -name "*.pyc" -delete 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 # E series are pep8
# E126 continuation line over-indented for hanging indent # E126 continuation line over-indented for hanging indent
# E127 continuation line over-indented for visual indent # E127 continuation line over-indented for visual indent
# E128 continuation line under-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 # E402 module level import not at top of file
# E501 line too long > 80 # E501 line too long > 80
# H series are hacking # H series are hacking
@ -59,21 +62,23 @@ commands =
# H102 is apache license # H102 is apache license
# H104 file contains only comments (ie: license) # H104 file contains only comments (ie: license)
# H105 author tags # H105 author tags
# H231..H238 are python3 compatability # H232..H238 are python3 compatability
# H301: one import per line # H301 one import per line
# H306: imports not in alphabetical order # H306 imports not in alphabetical order
# H401,H403,H404,H405 are docstring and not important # H401 docstring should not start with a space
# H501: Do not use self.__dict__ for string formatting # H403 multi line docstrings should end on a new line
[flake8] # H404 multi line docstring should start without a leading new line
ignore = E126,E127,E128,E402,E501, # H405 multi line docstring summary not separated with an empty line
H101,H102,H104,H105,H232,H234,H235,H236,H237,H238, # H501 Do not use self.__dict__ for string formatting
H301,H306,H401,H403,H404,H405,H501 # H701 Empty localization string
builtins = _ # 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] [testenv:flake8]
basepython = python2.7 basepython = python2.7
deps = hacking deps = -r{toxinidir}/test-requirements.txt
flake8<3.6.0
commands = commands =
flake8 {posargs} . \ flake8 {posargs} . \
sysinv/cmd/manage-partitions \ sysinv/cmd/manage-partitions \

View File

@ -1,3 +1,4 @@
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
bashate >= 0.2 bashate >= 0.2
PyYAML >= 3.1.0 PyYAML >= 3.1.0
yamllint >= 0.5.2 yamllint >= 0.5.2

View File

@ -41,10 +41,9 @@ commands =
basepython = python3 basepython = python3
usedevelop = False usedevelop = False
skip_install = True skip_install = True
deps = deps = -r{toxinidir}/test-requirements.txt
pep8
commands = commands =
pep8 flake8
[testenv:venv] [testenv:venv]
basepython = python3 basepython = python3