From b4723246648b854a19ac5d9b7f5f1440eebf4441 Mon Sep 17 00:00:00 2001 From: Al Bailey Date: Fri, 31 Aug 2018 14:54:47 -0500 Subject: [PATCH] Enable pylint for nfv as a gating job for stx-nfv This invokes pylint on all the nfv code. The pylint.rc file currently suppresses failing lint tests. In later submissions those suppressed types will be enabled and their code fixed. Story: 2003499 TaskId: 24944 Change-Id: I4726927a9e5e76a242dec3f7b25f51b2887e505e Signed-off-by: Al Bailey --- .zuul.yaml | 10 ++++++++++ nfv/nfv-tests/nfv_unit_tests/pylint.rc | 20 +++++++++++++++++-- nfv/nfv-tests/nfv_unit_tests/tox.ini | 2 ++ tox.ini | 27 +++++++++++++++++++++++++- 4 files changed, 56 insertions(+), 3 deletions(-) diff --git a/.zuul.yaml b/.zuul.yaml index 4a96d92e..a65c824c 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -6,7 +6,17 @@ - openstack-tox-pep8 - openstack-tox-py27: voting: false + - nfv-tox-pylint gate: jobs: - openstack-tox-linters - openstack-tox-pep8 + +- job: + name: nfv-tox-pylint + parent: tox + description: Run pylint for nfv + required-projects: + - openstack/stx-fault + vars: + tox_envlist: pylint diff --git a/nfv/nfv-tests/nfv_unit_tests/pylint.rc b/nfv/nfv-tests/nfv_unit_tests/pylint.rc index 9f79a19e..042d61d9 100755 --- a/nfv/nfv-tests/nfv_unit_tests/pylint.rc +++ b/nfv/nfv-tests/nfv_unit_tests/pylint.rc @@ -26,14 +26,30 @@ load-plugins= # can either give multiple identifier separated by comma (,) or put this option # multiple time (only on the command line, not in the configuration file where # it should appear only once). +# W0102 dangerous-default-value +# W0107 unnecessary-pass +# W0120 useless-else-on-loop +# W0125 using-constant-test # W0212 protected-access var starting with _ used outside class or descendant +# W0221 arguments-differ +# W0223 abstract-method +# W0231 super-init-not-called +# W0235 useless-super-delegation +# W0311 bad-indentation +# W0401 wildcard-import # W0403 relative-import warning +# W0404 reimported +# W0511 fixme # W0603 Using the global statement warning # W0612 Unused variable warning # W0613 Unused argument warning +# W0621 redefined-outer-name +# W0631 undefined-loop-variable +# W0622 redefined-builtin # W0703 broad except warning -#disable=C, R, W0212, W0403, W0603, W0612, W0613, W0703 -disable=C, R, W +# W1401 anomalous-backslash-in-string +disable=C, R, W0102, W0107, W0120, W0125, W0212, W0221, W0223, W0231, W0235, W0311, + W0401, W0403, W0404, W0511, W0603, W0612, W0613, W0621, W0622, W0631, W0703, W1401 [REPORTS] diff --git a/nfv/nfv-tests/nfv_unit_tests/tox.ini b/nfv/nfv-tests/nfv_unit_tests/tox.ini index d6fd4281..13a7a0d7 100755 --- a/nfv/nfv-tests/nfv_unit_tests/tox.ini +++ b/nfv/nfv-tests/nfv_unit_tests/tox.ini @@ -14,6 +14,7 @@ nfv_client_dir = ../../nfv-client nfv_common_dir = ../../nfv-common nfv_plugins_dir = ../../nfv-plugins nfv_vim_dir = ../../nfv-vim +stx_fault_dir = ../../../../stx-fault nfv_client_src_dir = {[nfv]nfv_client_dir}/nfv_client nfv_common_src_dir = {[nfv]nfv_common_dir}/nfv_common @@ -24,6 +25,7 @@ deps = {[nfv]nfv_client_dir} {[nfv]nfv_common_dir} {[nfv]nfv_plugins_dir} {[nfv]nfv_vim_dir} + {[nfv]stx_fault_dir}/fm-api iso8601 keyring kombu diff --git a/tox.ini b/tox.ini index b738c4cb..6d940e00 100644 --- a/tox.ini +++ b/tox.ini @@ -47,7 +47,7 @@ commands = # E265 block comment should start with '# ' # E251 unexpected spaces around keyword / parameter equals # E302 expected 2 blank lines, found 1 -# E303 too many blank lines +# E303 too many blank lines # E501 line too long # E712 comparison to bool should be reworded @@ -81,3 +81,28 @@ commands = {[testenv]commands} cp -v nfv/nfv-tests/nfv_unit_tests/test_data/nfv_vim_db_18.03_GA {envdir}/ nosetests --exe -w nfv/nfv-tests/nfv_unit_tests/tests/ '{posargs}' +[testenv:pylint] +basepython = python2.7 +deps = {[testenv]deps} + {toxinidir}/nfv/nfv-client + {toxinidir}/nfv/nfv-common + {toxinidir}/nfv/nfv-plugins + {toxinidir}/nfv/nfv-vim + {toxinidir}/../stx-fault/fm-api + iso8601 + keyring + kombu + kubernetes + passlib + pecan + pyparsing + wsme + pylint +whitelist_externals = cp + find +commands = pylint nfv/nfv-client/nfv_client \ + nfv/nfv-common/nfv_common \ + nfv/nfv-plugins/nfv_plugins \ + nfv/nfv-vim/nfv_vim \ + --rcfile=nfv/nfv-tests/nfv_unit_tests/pylint.rc +