Starting with Python 3.6, invalid escape sequences in string literals
are now deprecated[1]. This influence also automatic style checkers like
pycodestyle which starting with 2.4.0 complains about invalid escape
sequences (W605)[2].
Let's fix all those warnings at once by using raw strings where possible
and adding additional \ where not.
Footnotes:
1 - https://docs.python.org/3/whatsnew/3.6.html#deprecated-python-behavior
2 - https://github.com/PyCQA/pycodestyle/pull/676
Change-Id: I009a366fd8342edfd30890df6fe8e1fca88bf3cc
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
The messages for many of the errors reported by pylint have been
extended to include "suggestions" (especially in the case of undefined
variables or members). Rather than update all of the individual
messages in the configuration file, just treat the messages as
prefixes.
Change-Id: I1f11c50e39dbd43c4a9b54ccaaccf03f5ff07aca
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit includes two cleanups in trove-pylint.
First, the deprecation warning is because the text.ParseableOutputFormat is
being deprecated[1] and produces a deprecation warning as shown in the
bug.
Second, while looking into 1650816, I stumbled upon 1650888 which is
also fixed. A block of code was wrongly indented and when I disabled
"-E" to generate warnings, produced a crash in pylint. If the line
generated doesn't match the regular expression, the various parameters
to the next call (to ignore()) are not set and you get unbound
variable errors.
[1] https://github.com/PyCQA/pylint/blob/master/pylint/reporters/text.py#L163
Change-Id: I43bd6569a98eeb1b326e4a0ca1addaf97c0830a5
Closes-Bug: #1650530
Closes-But: #1650888
When someone has a pylint config file that has an error such as when a
merge goes bad, loading the file fails, and pylint motors along
happily with the default file (i.e. nothing ignored) and this is
confusing. Unless you happen to catch the little error that it prints
out.
Instead, just bomb out with an error.
Change-Id: Ie94dda35652f2a8f06502af72b68be73d61fc94a
Closes-Bug: 1639040
Since the config is not in a deterministic order makes it hard to
compare two config's and see what changed. Personally, I'm not
positive I understand this use-case; i.e. you have an existing config
file, you save it, and then rebuild and then diff the two files. I'd
have thought you'd just run check and the output of the tool was the
diff.
I however do see the value in sorting the file so that when someone
submits a change that includes a change to the config, reviewers can
see more easily what the change is doing.
Similarly, the output from pylint (errors) are generated one file at a
time and os.walk makes no guarantee of deterministic order. So we
should collect all errors (across all files) and then print an ordered
list for human consumption.
The intent is also to make pylint voting soon (in master). the changes
to contributing.rst and tox.ini are to make that easier. The config
file has also been sorted in place.
This change was motivated by an email exchange with Peter so I am
marking him as a co-conspirator.
The line numbers were removed from the tools/trove-pylint.config file
as these would change whenever the line numbers in the file changed
(since they are currently not being used in the comparison; they can
be re-added if deemed necessary at the cost of having every 'rebuild'
run create a different file).
The tools/trove-pylint.config was regenerated as well, since the
remaining two errors seem to be innocuous:
ERROR: trove/taskmanager/manager.py 392: E1101 no-member,
Manager.upgrade: Instance of 'BuiltInstance' has no 'upgrade' member
(new method introduced by instance upgrade; other BuiltInstance
member errors are already ignored.)
and
ERROR: trove/guestagent/datastore/experimental/postgresql/service/
access.py 80: E1101 no-member, PgSqlAccess.list_access: Instance ofi
'PgSqlAccess' has no '_find_user' member
(this is due to the fact that PostgreSQL is spread over multiple
files and pylint should cease to complain once
https://review.openstack.org/#/c/346082/ lands.)
Change-Id: I910c738d3845b7749e57910f76523150ec5a5bff
Closes-Bug: #1625158
Closes-Bug: #1625245
Co-Authored-By: Peter Stachowski <peter@tesora.com>
this is a pylint wrapper for Trove's tox tests. This commit includes a
basic infrastructure for running pylint through tox.
It also fixes some very obvious import errors that are flagged by the
tool. One is to handle missing imports for _ and _LE.
There is one instance where an exception is being raised but
trove.common.exception isn't imported, and another where an exception
is being incorrectly thrown.
A short readme is also provided.
Change-Id: I0a38f5efde3cb491f1f6c27f6c6500ab29987968
Partial-Bug: #1621636