diff --git a/.zuul.yaml b/.zuul.yaml index 85a56388..4631e0d3 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -9,10 +9,12 @@ jobs: - openstack-tox-pep8 - openstack-tox-linters + - ha-tox-pylint gate: jobs: - openstack-tox-pep8 - openstack-tox-linters + - ha-tox-pylint post: jobs: - stx-ha-upload-git-mirror @@ -56,6 +58,14 @@ nfv: https://opendev.org/starlingx/nfv update: https://opendev.org/starlingx/update +- job: + name: ha-tox-pylint + parent: tox + description: | + Run pylint test for ha in python2.7 + nodeset: ubuntu-bionic + vars: + tox_envlist: pylint - job: name: stx-ha-upload-git-mirror parent: upload-git-mirror diff --git a/test-requirements.txt b/test-requirements.txt index 0375f1c0..1132aeaa 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,3 +1,4 @@ +hacking bashate >= 0.2 PyYAML >= 3.1.0 yamllint >= 0.5.2 diff --git a/tox.ini b/tox.ini index 55631319..16508019 100644 --- a/tox.ini +++ b/tox.ini @@ -15,6 +15,27 @@ deps = -r{toxinidir}/test-requirements.txt whitelist_externals = reno [testenv:linters] +basepython = python3 +whitelist_externals = bash +commands = + bash -c "find {toxinidir} \ + -not \( -type d -name .?\* -prune \) \ + -type f \ + -not -name \*~ \ + -not -name \*.md \ + \( \ + -name \*.sh \ + -or -not -wholename \*/devstack/files/\* \ + -wholename \*/devstack/\* \ + \) \ + -print0 | xargs -r -n 1 -0 bashate -v -e E* -i E006" + bash -c "find {toxinidir} \ + \( -name middleware/io-monitor/recipes-common/io-monitor/io-monitor/io_monitor/test-tools/yaml/* -prune \) \ + -o \( -name .tox -prune \) \ + -o -type f -name '*.yaml' \ + -print0 | xargs -0 yamllint" + +[testenv:pylint] basepython = python2.7 deps = {[testenv]deps} eventlet @@ -32,24 +53,7 @@ deps = {[testenv]deps} sqlalchemy-migrate wsme pylint -whitelist_externals = bash commands = - bash -c "find {toxinidir} \ - -not \( -type d -name .?\* -prune \) \ - -type f \ - -not -name \*~ \ - -not -name \*.md \ - \( \ - -name \*.sh \ - -or -not -wholename \*/devstack/files/\* \ - -wholename \*/devstack/\* \ - \) \ - -print0 | xargs -0 bashate -v" - bash -c "find {toxinidir} \ - \( -name middleware/io-monitor/recipes-common/io-monitor/io-monitor/io_monitor/test-tools/yaml/* -prune \) \ - -o \( -name .tox -prune \) \ - -o -type f -name '*.yaml' \ - -print0 | xargs -0 yamllint" pylint --rcfile=./pylint.rc --extension-pkg-whitelist=greenlet \ ./service-mgmt-api/sm-api/sm_api/ \ ./service-mgmt-tools/sm-tools/sm_tools/ \ @@ -68,15 +72,24 @@ commands = # 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 locals() for string formatting +# W are warnings +# W504 W504 line break after binary operator +# W605 invalid escape sequence # - errors - +# E741 ambiguous variable name # F811 redefinition of unused '' from line # F821 undefined name 'e' +# F841 local variable +# F901 'raise NotImplemented' should be 'raise NotImplementedError' # - bugbear - # B008 Do not perform calls in argument defaults. The call is performed only once at function definition time. +# B014 Redundant exception types ignore= E402, H102,H104,H105,H106,H306,H401,H403,H404,H405,H501, - F811,F821, - B008 + W504,W605, + E741, + F811,F821,F841,F901, + B008,B014 # Enable checks which are off by default # H106 Don’t put vim configuration in source files (off by default). SHOULD BE ENABLED. # H203 Use assertIs(Not)None to check for None (off by default). @@ -89,9 +102,8 @@ basepython = python3 usedevelop = False skip_install = True deps = - hacking - flake8-bugbear<=19.3.0 - flake8 < 3.6.0 + -r{toxinidir}/test-requirements.txt + flake8-bugbear commands = flake8