Browse Source

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>
Al Bailey 4 months ago
parent
commit
a94ee08d50

+ 17
- 0
.zuul.yaml View File

@@ -9,6 +9,7 @@
9 9
         - openstack-tox-linters
10 10
         - sysinv-tox-py27
11 11
         - sysinv-tox-flake8
12
+        - sysinv-tox-pylint
12 13
         - controllerconfig-tox-flake8
13 14
         - controllerconfig-tox-py27
14 15
         - controllerconfig-tox-pylint
@@ -25,6 +26,7 @@
25 26
         - openstack-tox-linters
26 27
         - sysinv-tox-py27
27 28
         - sysinv-tox-flake8
29
+        - sysinv-tox-pylint
28 30
         - controllerconfig-tox-flake8
29 31
         - controllerconfig-tox-py27
30 32
         - controllerconfig-tox-pylint
@@ -64,6 +66,21 @@
64 66
       tox_envlist: flake8
65 67
       tox_extra_args: -c sysinv/sysinv/sysinv/tox.ini
66 68
 
69
+- job:
70
+    name: sysinv-tox-pylint
71
+    parent: tox
72
+    description: |
73
+      Run pylint test for sysinv
74
+    required-projects:
75
+      - openstack/stx-update
76
+      - openstack/stx-fault
77
+      - openstack/stx-integ
78
+    files:
79
+      - sysinv/sysinv/*
80
+    vars:
81
+      tox_envlist: pylint
82
+      tox_extra_args: -c sysinv/sysinv/sysinv/tox.ini
83
+
67 84
 - job:
68 85
     name: controllerconfig-tox-flake8
69 86
     parent: tox

+ 21
- 2
controllerconfig/controllerconfig/pylint.rc View File

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

+ 27
- 3
sysinv/cgts-client/cgts-client/pylint.rc View File

@@ -29,10 +29,34 @@ load-plugins=
29 29
 # https://pylint.readthedocs.io/en/latest/user_guide/output.html#source-code-analysis-section
30 30
 # We are disabling (C)onvention
31 31
 # We are disabling (R)efactor
32
-# We are probably disabling (W)arning
32
+# We are selectively disabling (W)arning
33 33
 # We are not disabling (F)atal, (E)rror
34
-#disable=C,R,W
35
-disable=C,R,W
34
+# The following warnings are disabled and should be fixed:
35
+# fixme (notes, todo, xxx)
36
+# W0102: dangerous-default-value
37
+# W0105: pointless-string-statement
38
+# W0108: unnecessary-lambda
39
+# W0110: deprecated-lambda
40
+# W0120: useless-else-on-loop
41
+# W0123: eval-used
42
+# W0201: attribute-defined-outside-init
43
+# W0212: protected-access
44
+# W0231: super-init-not-called
45
+# W0235: useless-super-delegation
46
+# W0402: deprecated-module
47
+# W0403: relative-import
48
+# W0603: global-statement
49
+# W0611: unused-import
50
+# W0612: unused-variable
51
+# W0613: unused-argument
52
+# W0621: redefined-outer-name
53
+# W0622: redefined-builtin
54
+# W0631: undefined-loop-variable
55
+# W0703: broad-except
56
+# W1201: logging-not-lazy
57
+# W1401: anomalous-backslash-in-string
58
+disable=C, R, fixme, W0102, W0105, W0108, W0110, W0120, W0123, W0201, W0212, W0231, W0235,
59
+        W0402, W0403, W0603, W0611, W0612, W0613, W0621, W0622, W0631, W0703, W1201, W1401
36 60
 
37 61
 
38 62
 [REPORTS]

+ 66
- 4
sysinv/sysinv/sysinv/pylint.rc View File

@@ -29,11 +29,73 @@ load-plugins=
29 29
 # https://pylint.readthedocs.io/en/latest/user_guide/output.html#source-code-analysis-section
30 30
 # We are disabling (C)onvention
31 31
 # We are disabling (R)efactor
32
-# We are probably disabling (W)arning
32
+# We are selectively disabling (W)arning
33 33
 # We are not disabling (F)atal, (E)rror
34
-disable=C,R,W
35
-#disable=C,R
36
-
34
+# The following warnings should be fixed:
35
+# fixme (todo, xxx, fixme)
36
+# W0101: unreachable
37
+# W0102: dangerous-default-value
38
+# W0105: pointless-string-statement
39
+# W0106: expression-not-assigned
40
+# W0107: unnecessary-pass
41
+# W0108: unnecessary-lambda
42
+# W0110: deprecated-lambda
43
+# W0120: useless-else-on-loop
44
+# W0123: eval-used
45
+# W0150: lost-exception
46
+# W0201: attribute-defined-outside-init
47
+# W0211: bad-staticmethod-argument
48
+# W0212: protected-access
49
+# W0221: arguments-differ
50
+# W0223: abstract-method
51
+# W0231: super-init-not-called
52
+# W0235: useless-super-delegation
53
+# W0311: bad-indentation
54
+# W0402: deprecated-module
55
+# W0403: relative-import
56
+# W0404: reimported
57
+# W0603: global-statement
58
+# W0611: unused-import
59
+# W0612: unused-variable
60
+# W0613: unused-argument
61
+# W0621: redefined-outer-name
62
+# W0622: redefined-builtin
63
+# W0631: undefined-loop-variable
64
+# W0632: unbalanced-tuple-unpacking
65
+# W0701:  bad-except-order
66
+# W0703: broad-except
67
+# W1113: keyword-arg-before-vararg
68
+# W1201: logging-not-lazy
69
+# W1401: anomalous-backslash-in-string
70
+# W1505: deprecated-method
71
+# All these errors should be fixed:
72
+# E0202: method-hidden
73
+# E0203: access-member-before-definition
74
+# E0213: no-self-argument
75
+# E0401: import-error
76
+# E0602: undefined-variable
77
+# E0604: invalid-all-object
78
+# E0611: no-name-in-module
79
+# E0633: unpacking-non-sequence
80
+# E0701: bad-except-order
81
+# E0702: raising-bad-type
82
+# E0712: catching-non-exception
83
+# E1003: bad-super-call
84
+# E1101: no-member
85
+# E1102: not-callable
86
+# E1111: assignment-from-no-return
87
+# E1120: no-value-for-parameter
88
+# E1121: too-many-function-args
89
+# E1124: redundant-keyword-arg
90
+# E1136: unsubscriptable-object
91
+# E1205: logging-too-many-args
92
+# E1305: too-many-format-args
93
+disable=C, R, fixme, W0101, W0102, W0105, W0106, W0107, W0108, W0110, W0120, W0123, W0150,
94
+        W0201, W0211, W0212, W0221, W0223, W0231, W0235, W0311, W0402, W0403, W0404,
95
+        W0603, W0611, W0612, W0613, W0621, W0622, W0631, W0632, W0701, W0703,
96
+        W1113, W1201, W1401, W1505,
97
+        E0202, E0203, E0213, E0401, E0602, E0604, E0611, E0633, E0701, E0702, E0712,
98
+        E1003, E1101, E1102, E1111, E1120, E1121, E1124, E1136, E1205, E1305
37 99
 
38 100
 [REPORTS]
39 101
 # Set the output format. Available formats are text, parseable, colorized, msvs

+ 16
- 17
sysinv/sysinv/sysinv/tox.ini View File

@@ -1,13 +1,12 @@
1 1
 [tox]
2
-envlist = flake8,py27
2
+envlist = flake8,py27, pylint
3 3
 minversion = 1.6
4 4
 # skipsdist = True
5 5
 #,pip-missing-reqs
6 6
 
7 7
 # tox does not work if the path to the workdir is too long, so move it to /tmp
8 8
 toxworkdir = /tmp/{env:USER}_sysinvtox
9
-wrsdir = {toxinidir}/../../../../../../../../..
10
-cgcsdir = {toxinidir}/../../../..
9
+stxdir = {toxinidir}/../../../..
11 10
 distshare={toxworkdir}/.tox/distshare
12 11
 
13 12
 [testenv]
@@ -38,13 +37,13 @@ setenv = VIRTUAL_ENV={envdir}
38 37
 
39 38
 deps = -r{toxinidir}/requirements.txt
40 39
        -r{toxinidir}/test-requirements.txt
41
-       -e{[tox]cgcsdir}/stx-update/tsconfig/tsconfig
42
-       -e{[tox]cgcsdir}/stx-config/configutilities/configutilities
43
-       -e{[tox]cgcsdir}/stx-fault/fm-api
44
-       -e{[tox]cgcsdir}/stx-fault/python-fmclient/fmclient
45
-       -e{[tox]cgcsdir}/stx-config/controllerconfig/controllerconfig
46
-       -e{[tox]cgcsdir}/stx-update/cgcs-patch/cgcs-patch
47
-       -e{[tox]cgcsdir}/stx-integ/utilities/platform-util/platform-util
40
+       -e{[tox]stxdir}/stx-update/tsconfig/tsconfig
41
+       -e{[tox]stxdir}/stx-config/configutilities/configutilities
42
+       -e{[tox]stxdir}/stx-fault/fm-api
43
+       -e{[tox]stxdir}/stx-fault/python-fmclient/fmclient
44
+       -e{[tox]stxdir}/stx-config/controllerconfig/controllerconfig
45
+       -e{[tox]stxdir}/stx-update/cgcs-patch/cgcs-patch
46
+       -e{[tox]stxdir}/stx-integ/utilities/platform-util/platform-util
48 47
 
49 48
 commands =
50 49
   find . -type f -name "*.pyc" -delete
@@ -136,19 +135,19 @@ basepython = python2.7
136 135
 sitepackages = False
137 136
 
138 137
 deps = {[testenv]deps}
139
-        pylint
138
+       pylint
140 139
 commands =
141 140
      pylint {posargs} sysinv --rcfile=./pylint.rc  --extension-pkg-whitelist=lxml.etree,greenlet
142 141
 
143 142
 [testenv:cover]
144 143
 basepython = python2.7
145 144
 deps = {[testenv]deps}
146
-       -e{[tox]cgcsdir}/stx-update/tsconfig/tsconfig
147
-       -e{[tox]cgcsdir}/stx-config/configutilities/configutilities
148
-       -e{[tox]cgcsdir}/stx-fault/fm-api
149
-       -e{[tox]cgcsdir}/stx-config/controllerconfig/controllerconfig
150
-       -e{[tox]cgcsdir}/stx-update/cgcs-patch/cgcs-patch
151
-       -e{[tox]cgcsdir}/stx-integ/utilities/platform-util/platform-util
145
+       -e{[tox]stxdir}/stx-update/tsconfig/tsconfig
146
+       -e{[tox]stxdir}/stx-config/configutilities/configutilities
147
+       -e{[tox]stxdir}/stx-fault/fm-api
148
+       -e{[tox]stxdir}/stx-config/controllerconfig/controllerconfig
149
+       -e{[tox]stxdir}/stx-update/cgcs-patch/cgcs-patch
150
+       -e{[tox]stxdir}/stx-integ/utilities/platform-util/platform-util
152 151
 
153 152
 commands =
154 153
   find . -type f -name "*.pyc" -delete

Loading…
Cancel
Save