Improve pylint checking in stx-config

Previously when pylint was invoked, all warnings were suppressed.
Now, the only warnings suppressed are the ones that are failing.
By making this change, fixed issues will not be reintroduced
by later commits.

Additional tasks will be created in the future to address the
currently suppressed warnings and errors.

This also adds a zuul job for pylint in sysinv.

Story: 2004515
Task: 28268
Change-Id: Ie162c08a9e70a70bfc089ebee711ef9d6a374f2b
Signed-off-by: Al Bailey <Al.Bailey@windriver.com>
This commit is contained in:
Al Bailey 2018-12-04 13:45:38 -06:00
parent 977112e99e
commit a94ee08d50
5 changed files with 147 additions and 26 deletions

View File

@ -9,6 +9,7 @@
- openstack-tox-linters - openstack-tox-linters
- sysinv-tox-py27 - sysinv-tox-py27
- sysinv-tox-flake8 - sysinv-tox-flake8
- sysinv-tox-pylint
- controllerconfig-tox-flake8 - controllerconfig-tox-flake8
- controllerconfig-tox-py27 - controllerconfig-tox-py27
- controllerconfig-tox-pylint - controllerconfig-tox-pylint
@ -25,6 +26,7 @@
- openstack-tox-linters - openstack-tox-linters
- sysinv-tox-py27 - sysinv-tox-py27
- sysinv-tox-flake8 - sysinv-tox-flake8
- sysinv-tox-pylint
- controllerconfig-tox-flake8 - controllerconfig-tox-flake8
- controllerconfig-tox-py27 - controllerconfig-tox-py27
- controllerconfig-tox-pylint - controllerconfig-tox-pylint
@ -64,6 +66,21 @@
tox_envlist: flake8 tox_envlist: flake8
tox_extra_args: -c sysinv/sysinv/sysinv/tox.ini tox_extra_args: -c sysinv/sysinv/sysinv/tox.ini
- job:
name: sysinv-tox-pylint
parent: tox
description: |
Run pylint test for sysinv
required-projects:
- openstack/stx-update
- openstack/stx-fault
- openstack/stx-integ
files:
- sysinv/sysinv/*
vars:
tox_envlist: pylint
tox_extra_args: -c sysinv/sysinv/sysinv/tox.ini
- job: - job:
name: controllerconfig-tox-flake8 name: controllerconfig-tox-flake8
parent: tox parent: tox

View File

@ -29,9 +29,28 @@ load-plugins=
# https://pylint.readthedocs.io/en/latest/user_guide/output.html#source-code-analysis-section # https://pylint.readthedocs.io/en/latest/user_guide/output.html#source-code-analysis-section
# We are disabling (C)onvention # We are disabling (C)onvention
# We are disabling (R)efactor # We are disabling (R)efactor
# We are probably disabling (W)arning # We are selectively disabling (W)arnings
# We are not disabling (F)atal, (E)rror # We are not disabling (F)atal, (E)rror
disable=C, R, W # The following suppressed warnings should be fixed:
# fixme: (notes, xxx, fixme)
# W0101: unreachable-code
# W0105: pointless-string-statement
# W0110: deprecated-lambda
# W0120: useless-else-on-loop
# W0201: attribute-defined-outside-init
# W0211: bad-staticmethod-argument
# W0212: protected-access
# W0311: bad-indentation
# W0403: relative-import
# W0612: unused-variable
# W0613: unused-argument
# W0621: redefined-outer-name
# W0622: redefined-builtin
# W0631: undefined-loop-variable
# W0703: broad-except
# W1501: bad-open-mode
disable=C, R, fixme, W0101, W0105, W0110, W0120, W0201, W0211, W0212, W0311, W0403,
W0612, W0613, W0621, W0622, W0631, W0703, W1501
[REPORTS] [REPORTS]

View File

@ -29,10 +29,34 @@ load-plugins=
# https://pylint.readthedocs.io/en/latest/user_guide/output.html#source-code-analysis-section # https://pylint.readthedocs.io/en/latest/user_guide/output.html#source-code-analysis-section
# We are disabling (C)onvention # We are disabling (C)onvention
# We are disabling (R)efactor # We are disabling (R)efactor
# We are probably disabling (W)arning # We are selectively disabling (W)arning
# We are not disabling (F)atal, (E)rror # We are not disabling (F)atal, (E)rror
#disable=C,R,W # The following warnings are disabled and should be fixed:
disable=C,R,W # fixme (notes, todo, xxx)
# W0102: dangerous-default-value
# W0105: pointless-string-statement
# W0108: unnecessary-lambda
# W0110: deprecated-lambda
# W0120: useless-else-on-loop
# W0123: eval-used
# W0201: attribute-defined-outside-init
# W0212: protected-access
# W0231: super-init-not-called
# W0235: useless-super-delegation
# W0402: deprecated-module
# W0403: relative-import
# W0603: global-statement
# W0611: unused-import
# W0612: unused-variable
# W0613: unused-argument
# W0621: redefined-outer-name
# W0622: redefined-builtin
# W0631: undefined-loop-variable
# W0703: broad-except
# W1201: logging-not-lazy
# W1401: anomalous-backslash-in-string
disable=C, R, fixme, W0102, W0105, W0108, W0110, W0120, W0123, W0201, W0212, W0231, W0235,
W0402, W0403, W0603, W0611, W0612, W0613, W0621, W0622, W0631, W0703, W1201, W1401
[REPORTS] [REPORTS]

View File

@ -29,11 +29,73 @@ load-plugins=
# https://pylint.readthedocs.io/en/latest/user_guide/output.html#source-code-analysis-section # https://pylint.readthedocs.io/en/latest/user_guide/output.html#source-code-analysis-section
# We are disabling (C)onvention # We are disabling (C)onvention
# We are disabling (R)efactor # We are disabling (R)efactor
# We are probably disabling (W)arning # We are selectively disabling (W)arning
# We are not disabling (F)atal, (E)rror # We are not disabling (F)atal, (E)rror
disable=C,R,W # The following warnings should be fixed:
#disable=C,R # fixme (todo, xxx, fixme)
# W0101: unreachable
# W0102: dangerous-default-value
# W0105: pointless-string-statement
# W0106: expression-not-assigned
# W0107: unnecessary-pass
# W0108: unnecessary-lambda
# W0110: deprecated-lambda
# W0120: useless-else-on-loop
# W0123: eval-used
# W0150: lost-exception
# W0201: attribute-defined-outside-init
# W0211: bad-staticmethod-argument
# W0212: protected-access
# W0221: arguments-differ
# W0223: abstract-method
# W0231: super-init-not-called
# W0235: useless-super-delegation
# W0311: bad-indentation
# W0402: deprecated-module
# W0403: relative-import
# W0404: reimported
# W0603: global-statement
# W0611: unused-import
# W0612: unused-variable
# W0613: unused-argument
# W0621: redefined-outer-name
# W0622: redefined-builtin
# W0631: undefined-loop-variable
# W0632: unbalanced-tuple-unpacking
# W0701: bad-except-order
# W0703: broad-except
# W1113: keyword-arg-before-vararg
# W1201: logging-not-lazy
# W1401: anomalous-backslash-in-string
# W1505: deprecated-method
# All these errors should be fixed:
# E0202: method-hidden
# E0203: access-member-before-definition
# E0213: no-self-argument
# E0401: import-error
# E0602: undefined-variable
# E0604: invalid-all-object
# E0611: no-name-in-module
# E0633: unpacking-non-sequence
# E0701: bad-except-order
# E0702: raising-bad-type
# E0712: catching-non-exception
# E1003: bad-super-call
# E1101: no-member
# E1102: not-callable
# E1111: assignment-from-no-return
# E1120: no-value-for-parameter
# E1121: too-many-function-args
# E1124: redundant-keyword-arg
# E1136: unsubscriptable-object
# E1205: logging-too-many-args
# E1305: too-many-format-args
disable=C, R, fixme, W0101, W0102, W0105, W0106, W0107, W0108, W0110, W0120, W0123, W0150,
W0201, W0211, W0212, W0221, W0223, W0231, W0235, W0311, W0402, W0403, W0404,
W0603, W0611, W0612, W0613, W0621, W0622, W0631, W0632, W0701, W0703,
W1113, W1201, W1401, W1505,
E0202, E0203, E0213, E0401, E0602, E0604, E0611, E0633, E0701, E0702, E0712,
E1003, E1101, E1102, E1111, E1120, E1121, E1124, E1136, E1205, E1305
[REPORTS] [REPORTS]
# Set the output format. Available formats are text, parseable, colorized, msvs # Set the output format. Available formats are text, parseable, colorized, msvs

View File

@ -1,13 +1,12 @@
[tox] [tox]
envlist = flake8,py27 envlist = flake8,py27, pylint
minversion = 1.6 minversion = 1.6
# skipsdist = True # skipsdist = True
#,pip-missing-reqs #,pip-missing-reqs
# 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}_sysinvtox toxworkdir = /tmp/{env:USER}_sysinvtox
wrsdir = {toxinidir}/../../../../../../../../.. stxdir = {toxinidir}/../../../..
cgcsdir = {toxinidir}/../../../..
distshare={toxworkdir}/.tox/distshare distshare={toxworkdir}/.tox/distshare
[testenv] [testenv]
@ -38,13 +37,13 @@ setenv = VIRTUAL_ENV={envdir}
deps = -r{toxinidir}/requirements.txt deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
-e{[tox]cgcsdir}/stx-update/tsconfig/tsconfig -e{[tox]stxdir}/stx-update/tsconfig/tsconfig
-e{[tox]cgcsdir}/stx-config/configutilities/configutilities -e{[tox]stxdir}/stx-config/configutilities/configutilities
-e{[tox]cgcsdir}/stx-fault/fm-api -e{[tox]stxdir}/stx-fault/fm-api
-e{[tox]cgcsdir}/stx-fault/python-fmclient/fmclient -e{[tox]stxdir}/stx-fault/python-fmclient/fmclient
-e{[tox]cgcsdir}/stx-config/controllerconfig/controllerconfig -e{[tox]stxdir}/stx-config/controllerconfig/controllerconfig
-e{[tox]cgcsdir}/stx-update/cgcs-patch/cgcs-patch -e{[tox]stxdir}/stx-update/cgcs-patch/cgcs-patch
-e{[tox]cgcsdir}/stx-integ/utilities/platform-util/platform-util -e{[tox]stxdir}/stx-integ/utilities/platform-util/platform-util
commands = commands =
find . -type f -name "*.pyc" -delete find . -type f -name "*.pyc" -delete
@ -136,19 +135,19 @@ basepython = python2.7
sitepackages = False sitepackages = False
deps = {[testenv]deps} deps = {[testenv]deps}
pylint pylint
commands = commands =
pylint {posargs} sysinv --rcfile=./pylint.rc --extension-pkg-whitelist=lxml.etree,greenlet pylint {posargs} sysinv --rcfile=./pylint.rc --extension-pkg-whitelist=lxml.etree,greenlet
[testenv:cover] [testenv:cover]
basepython = python2.7 basepython = python2.7
deps = {[testenv]deps} deps = {[testenv]deps}
-e{[tox]cgcsdir}/stx-update/tsconfig/tsconfig -e{[tox]stxdir}/stx-update/tsconfig/tsconfig
-e{[tox]cgcsdir}/stx-config/configutilities/configutilities -e{[tox]stxdir}/stx-config/configutilities/configutilities
-e{[tox]cgcsdir}/stx-fault/fm-api -e{[tox]stxdir}/stx-fault/fm-api
-e{[tox]cgcsdir}/stx-config/controllerconfig/controllerconfig -e{[tox]stxdir}/stx-config/controllerconfig/controllerconfig
-e{[tox]cgcsdir}/stx-update/cgcs-patch/cgcs-patch -e{[tox]stxdir}/stx-update/cgcs-patch/cgcs-patch
-e{[tox]cgcsdir}/stx-integ/utilities/platform-util/platform-util -e{[tox]stxdir}/stx-integ/utilities/platform-util/platform-util
commands = commands =
find . -type f -name "*.pyc" -delete find . -type f -name "*.pyc" -delete