From a8c228d5de6d257128c658177327eda769def032 Mon Sep 17 00:00:00 2001 From: Al Bailey Date: Thu, 25 Jul 2019 09:24:18 -0500 Subject: [PATCH] This commit adds a pep8 job to zuul Currently the pep8 errors that fail have been suppressed. Those suppressed errors can be fixed by future commits. This commit allows all the pep8/flake8 violations that are passing to remain that way by detecting any new code that violates those rules. Change-Id: I5bbcd6059a97705b34564adc27c71551cec4affe Story: 2004515 Task: 35985 Signed-off-by: Al Bailey --- .zuul.yaml | 2 ++ test-requirements.txt | 1 + tox.ini | 52 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+) diff --git a/.zuul.yaml b/.zuul.yaml index 5bdafcb..de35077 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -5,6 +5,8 @@ check: jobs: - build-openstack-releasenotes + - openstack-tox-pep8 gate: jobs: - build-openstack-releasenotes + - openstack-tox-pep8 diff --git a/test-requirements.txt b/test-requirements.txt index 78c9e45..516720b 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,3 +1,4 @@ +hacking>=1.1.0,<1.2.0 # Apache-2.0 PyYAML>=3.1.0 yamllint>=0.5.2 doc8 diff --git a/tox.ini b/tox.ini index 539819c..8e783ae 100644 --- a/tox.ini +++ b/tox.ini @@ -30,6 +30,58 @@ commands = -print0 | xargs -0 yamllint" doc8 doc/source +[testenv:pep8] +basepython = python3 +commands = flake8 {posargs} + +[flake8] +# Following checks should be enabled in the future. +# +# H101 Use TODO(NAME) +# H104 File contains nothing but comments +# H201 no 'except:' +# H238 old style class declaration +# 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 +# H903 Windows style line endings not allowed in code +# +# W291 trailing whitespace +# W292 no newline at end of file +# W391 blank line at end of file +# W503 line break before binary operator +# +# E121 continuation line under-indented for hanging indent +# E123 closing bracket does not match indentation of opening bracket's line +# 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 +# E241 multiple spaces after ',' +# E261 at least two spaces before inline comment +# E302 expected 2 blank lines, found 1 +# E303 too many blank lines +# E713 test for membership should be 'not in' +# E731 do not assign a lambda expression, use a def + +# +# F401 'X' imported but unused +# F403 ‘from module import *’ used; unable to detect undefined names +# F811 redefinition of unused 'X' from line 'Y' +# F841 local variable 'X' is assigned to but never used +# +ignore = H101,H104,H201,H238,H301,H306,H401,H403,H404,H405,H903, + W291,W292,W391,W503, + E121,E123,E126,E127,E128,E226,E261,E241,E302,E303,E713,E731, + F401,F403,F811,F841 +show-source = True +exclude=.venv,.git,.tox,dist,*lib/python*,*egg,build,doc/source/conf.py,releasenotes +# Default max-line-length is 80. This should be reduced as the files are cleaned up. +max-line-length = 109 + [testenv:releasenotes] basepython = python3 deps = -r{toxinidir}/doc/requirements.txt