From bcc938ca120ee1a31a6c0c79418cd83acdbf3de3 Mon Sep 17 00:00:00 2001 From: Al Bailey Date: Fri, 1 Feb 2019 15:58:29 -0600 Subject: [PATCH] Add additional checks to flake8 job By setting 'hacking' as the dependency, flake8 will include hacking and other checks. This is the same set used by other openstack components. This commit suppresses any of those new checks that would fail. H101 Use TODO(NAME) H102 Apache 2.0 license header not found H105 Don't use author tags H237 module posixfile is removed in Python 3 H238 old style class declaration H301 one import per line H306 imports not in alphabetical order H401 docstring should not start with a space H404 multi line docstring should start without a leading new line H405 multi line docstring summary not separated with an empty line It also sets the max line length to be very large. At a later time, additional commits will fix and un-suppress them. Story: 2004515 Task: 29303 Change-Id: Id572d5c0ecab1854ca881e34b95459ef563be0f2 Signed-off-by: Al Bailey --- test-requirements.txt | 1 + tox.ini | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/test-requirements.txt b/test-requirements.txt index f1587f3b..2b532f02 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,6 +1,7 @@ bashate >= 0.2 PyYAML >= 3.1.0 yamllint >= 0.5.2 +hacking!=0.13.0,<0.14,>=0.12.0 # The following are for py27 and py35 #mock # BSD #nose # LGPL diff --git a/tox.ini b/tox.ini index 289ad9a5..3ab5b666 100644 --- a/tox.ini +++ b/tox.ini @@ -51,21 +51,35 @@ commands = [flake8] # ignore below errors , will fix flake8 errors in future +# H101 Use TODO(NAME) +# H102 Apache 2.0 license header not found +# H105 Don't use author tags +# H237 module posixfile is removed in Python 3 +# H238 old style class declaration +# H301 one import per line +# H306 imports not in alphabetical order +# H401 docstring should not start with a space +# H404 multi line docstring should start without a leading new line +# H405 multi line docstring summary not separated with an empty line # E501 skipped because some of the code files include templates # that end up quite wide # F401 'XXXXX' imported but unused # F841 local variable 'XXXXXX' is assigned to but never used show-source = True -ignore = E501,F401,F841 +ignore = H101,H102,H105,H237,H238,H301,H306,H401,H404,H405,E501,F401,F841 exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,release-tag-* +# TODO: H106 Don’t put vim configuration in source files (off by default). +# H203 Use assertIs(Not)None to check for None (off by default). +# TODO: enable: H904 Delay string interpolations at logging calls (off by default). +enable-extensions = H203 +max-line-length = 120 + # Use flake8 to replace pep8. [testenv:pep8] basepython = python3 usedevelop = False skip_install = True -deps = - flake8<3.6.0 commands = flake8