There are a few warnings disabled that do not generate
failures any more, re-enable them by removing from
.pylintrc file.
TrivialFix
Change-Id: I1a4fff33b0dcd3d88b4ab0c86546098c7a9cafa4
After updating pylint, it started emitting additional "W"
warnings in some cases. Fix the missing-timeout ones by
adding a timeout=60 value to the calls done by the
metadata agent code.
Trivialfix
Change-Id: Ica5c2a2d3941813b3518b83738ada96bdf7c3760
After updating pylint, it started emitting additional "W"
warnings in some cases, fix some of them.
modified-iterating-list,
implicit-str-concat,
global-variable-not-assigned
Trivialfix
Change-Id: I7deb5f1e0aa2852cb033c78dcb4c8bc87e34be1e
After updating pylint, it started emitting additional "R"
warnings in some cases, fix some of them.
use-a-generator,
unnecessary-lambda-assignment,
consider-using-max-builtin,
consider-using-generator,
consider-using-in,
use-list-literal,
consider-using-from-import
Trivialfix
Change-Id: Ife6565cefcc30b4e8a0df9121c9454cf744225df
After updating pylint, it started emitting additional "E"
warnings in some cases, fix them.
unsubscriptable-object,
unsupported-delete-operation
These were associated with the OVN AgentCache code. Instead
of using a subscript, create get/delete methods to do the
same thing.
used-before-assignment
Re-factor some code so it's clear to pylint variables are
being assigned properly.
Trivialfix
Change-Id: I4a5ccb7f33465705e59b5274c41db3c371862b1e
After updating pylint, it started emitting additional "C"
warnings in some cases, fix some of them.
use-implicit-booleaness-not-comparison,
use-maxsplit-arg,
unnecessary-dunder-call
Trivialfix
Change-Id: I53558e6bc52aaea590f6c147aacc062c08099464
It has been over 2 years since we set the version of
pylint and associated tools in tox.ini, update to
something newer, specifically:
bashate>=2.1.1
bandit>=1.7.5
flake8-import-order==0.18.2
pylint==2.17.4
This required disabling additional checks for new
warnings that were found, and adding a directive to
add the "no-self-use" plugin that is now required
with the newer version.
Will work on fixing new warnings and re-enabling
checks in subsequent patches.
Trivialfix
Change-Id: I5d74d47ac1d8a085b447ff531d7abbecfb4cce6e
Update .pylintrc to be stricter, for example, to enforce
C0330 warnings (hanging/continued indentation). This
should be the end of the series.
Also did some cleanup of old unsupport options that pylint
complains about when you run it.
Change-Id: Id1bce82f584243b55a47fd6d5c5db81729e11f03
Use "value > constant" syntax and not vice-versa. Also
removed disable of misplaced-comparison-constant in
.pylintrc so future ones are caught.
Trivialfix
Change-Id: I733864e7437213bfb6edde24f207b2c9861998c6
Without the comma in the deprecated-modules section, any
subsequent arguments are silently ignored. Add it so pylint
will catch any six imports.
Change-Id: I4bca5ab81dd4ef6f28c7ff854dcc782a9b3c3f12
Instead of checking variables are equal to one of many
values, use a tuple and check if the variable is 'in' it.
This is faster and less verbose.
Change-Id: I429dbbd92a78fdfae3140cae8a397ff10f6d956e
The listed revision no longer supports python2, but afaik, we are
always running under python3 for those tests anyway.
Change-Id: Iba94d73eeb65fb21f5d098afe0fbe4348dbea850
Newer pylint added some checks that trigger a lot for this
code base. Turn them off until we are ready to apply the
new rules. They are:
- c-extension-no-member (Informational)
- keyword-arg-before-vararg (Warning)
- inconsistent-return-statements (Refactor recommendation)
Change-Id: I8c1f72bb334c87d62d47e8296d13c660d6bb5576
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
Recenly pylint version was bumped to 1.7.1 in global-requirements.txt.
Pylint 1.7.1 adds more checks and breaks the neutron pep8 job.
This commit adds new checks to the disabled list to avoid the gate
breakage. Individual disabled tests can be fixed later.
The new disabled list is compatible with pylint 1.4.5,
so we can merge this regardless of pylint bump is reverted or not.
Closes-Bug: #1696403
Change-Id: If6228d0626413049b82f9d75bcdf3bea7ddacde5
This is a community goal for Ocata. We're already not using any of
the code, but there are some other files and references left over.
Partial-Bug: #1639103
Change-Id: I2afd263ddc480e2512e3be77a03ffe5ae16e17a5
Debtcollector warnings are enabled by an env var for now, to avoid blasting
everyone's unit tests at once.
Partially-Implements: blueprint neutron-lib
Depends-On: I6991464acc3aef99f6ec5eff56a893deaaefe40b
Change-Id: If183b7a6797834e29c377937fc06261aa3b00249
This check attempts to detect dictionary literals with duplicate keys.
The rest of the Neutron tree has already had the few instances of this
cleaned[1] or moved into external vendor repos. Enabling the pylint
check will stop future occurrences.
[1] I29cd2b843a7905986de13a1ecfba0cb5797ccaf8
(Original patch I1aa221d2019853f905f2b8421dd45b0a3102baf0 by zhiyuan_cai)
Change-Id: If4fed9714cd7fa586845f21f8f56dde2645cc5e0
Co-Authored-By: zhiyuan_cai <luckyvega.g@gmail.com>
This change proposes to move pylint violation checks to the pep8
testenv. This changes make pylint gating within Neutron as it would
participate in the vote. Having pylint executed on a separate job makes
it difficult to handle potential unexpected breakages, because we need
to get infra involved. When we need to renable the job, it is equally
painful.
Furthermore, it also causes us to spin an extra node, when the checks
can easily be handled by the node for the pep8 job.
Finally, having pylint running with tox -epep8 "helps" developers
become aware of pylint violations sooner rather than later, if they
"forget" to run the pylint testenv too before submitting the change.
In order to make this patch succeed, a couple of pylint violation
checks were skipped, as they slipped in, whilst the job was non-voting.
We'll tackle them in due course.
Change-Id: Ida6ae44a837d1761f5ce3e8a92f8850407f5cd16
.. and disable the check locally for two midonet and Ryu classes that
fail since the midonet/ryu libraries are unavailable in our toxenv.
Change-Id: Idca46f853e6a116e8b2c246b4c6cae159894f887
Pylint last version(1.4.1), at least, reports an
unbalanced-tuple-unpacking warning[1] in keepalived[2] module because
self.authentication is defined as an empty tuple in __init__ method and
unpacked in build_config method as if it was a 2-tuple.
self.authentication references an empty tuple (defined in __init__
method) or a 2-tuple (updated in set_authentication method). Such
warning is a false positive because the unpacking is only performed if
self.authentication is not evaluated to false which only appends if
self.authentication is a 2-tuple.
Defining self.authentication as None in __init__ avoids such warning
without disabling unbalanced-tuple-unpacking warning check.
[1]
W:252,12: Possible unbalanced tuple unpacking with sequence defined at
line 153: left side has 2 label(s), right side has 0 value(s)
(unbalanced-tuple-unpacking)
[2] neutron.agent.linux.keepalived
Change-Id: Ifcdf08e574ef44a65c6d121323cbe31d9af2f921
Closes-Bug: #1411865
This check seems to have changed and started to break in Neutron.
Disabling it is one way we could get back to good.
Change-Id: I6d06d43cb2e78501cd69fcb3940694d04d936fa8
Closes-bug: #1411865
This check catches attempts to call variables that pylint believes are
not functions. A trivial example would be:
# Trivial example caught by this check:
foo = dict()
print foo('bar') # <- oops, meant foo['bar']
This change enables the "not-callable" pylint check, after disabling a
few cases where the alert triggers but the usage was intended (defining
decorators).
Change-Id: I09ad929902509018fe7183a15b784601c36b6196
Related-Bug: #1356224
Escapes in python string literals are well defined, but can be
confusing. These pylint checks look for backslash escapes in strings
that might be mistakes. Two code refactors were required to satisfy
these tests:
1. midonet_lib.py used \**kwargs in docstrings.
There doesn't seem to be a sphinx standard for kwargs, so this change
simply replaces them with "kwargs".
2. Regex literals containing escapes replaced with r''.
The assumption with this change (and the underlying pylint
check) is that r'' literals are more straightforward for regular
expressions, where every backslash is important.
While looking at these regexes, this change also removes a few
unnecessary "\-" escapes.
Change-Id: I01528b2482f78b9e851685ebbf6fded4e58355f1
This change replaces a few no-op string statements with regular
comments. While there was no harm in the previous use of strings for
comments, this allows us to re-enable the corresponding pylint check
which may catch genuinely unintended cases.
Change-Id: I796a059292e26c4df75c54f095d9e20e99187c98
This required a trivial refactor of two existing cases in the codebase.
These two cases were perfectly correct, but the check uncovered a 3rd
case which was a real bug (fixed separately). The new versions also
make it clear that if the loop fails to break early then the 'result' is
None (and thus an error) and not simply the last element. On balance,
it's probably worth enforcing this small inconvenience to coding style.
Change-Id: I780a95241f1454c6886d91f980eb9ada7678a119
Related-Bug: #1362466
_execute_request has a list of exception handlers to log various types
of errors with more specific error messages. Unfortunately, it catches
requests.exceptions.ConnectionError before requests.exceptions.SSLError,
but ConnectionError is a superclass of SSLError so the latter is never
invoked.
This change corrects the exception handling order, and enables the
bad-except-order pylint check now that the check passes.
Change-Id: I92bacd6088de5cbc170bc5c081a1db1baeec69e7
Closes-Bug: #1360970
"else" on for loops is only important if the loop contains a "break"
statement. Without a "break", the else block is _always_ executed and
it is clearer just to omit "else".
This change also enables the corresponding pylint warning, now that the
only offending case has been fixed.
Change-Id: Ibe8761cb40a7d2d564aa718d62c9f383b5ad711e
Add _MovedItems (from six.moves) to pylintrc ignored-modules, and adjust
one import of sqlalchemy.orm.properties.RelationshipProperty.
s.o.p.RelationshipProperty is created at import-time in a rather
exciting manner - rearranging the import in this way forces the
import-time code to be executed and seems sufficient to satisfy the
pylint static check.
Change-Id: Ic99dc2b7dfac75930a5c446ae899eaae09ee6174