- Release
2.13
- Date
TBA
Added several checkers to deal with unicode security issues (see Trojan Sources and PEP 672 for details) that also concern the readability of the code. In detail the following checks were added:
bad-file-encoding
checks that the file is encoded in UTF-8 as suggested by PEP8. UTF-16 and UTF-32 are not supported by Python at the moment. If this ever changesinvalid-unicode-codec
checks that they aren't used, to allow for backwards compatibility.bidirectional-unicode
checks for bidirectional unicode characters that could make code execution different than what the user expects.invalid-character-backspace
,invalid-character-carriage-return
,invalid-character-sub
,invalid-character-esc
,invalid-character-zero-width-space
andinvalid-character-nul
to check for possibly harmful unescaped characters.
Closes #5281
unnecessary-ellipsis
: Emitted when the ellipsis constant is used unnecessarily.Closes #5460
Add checker
redefined-slots-in-subclass
: Emitted when a slot is redefined in a subclass.Closes #5617
- Rewrote Checker of
non-ascii-name
. It now ensures __all__ Python names are ASCII and also properly checks the names of imports (
non-ascii-module-import
) as well as file names (non-ascii-file-name
) and emits their respective new warnings.Non ASCII characters could be homoglyphs (look alike characters) and hard to enter on a non specialized keyboard. See Confusable Characters in PEP 672
- Rewrote Checker of
Added
lru-cache-decorating-method
checker with checks for the use offunctools.lru_cache
on class methods. This is unrecommended as it creates memory leaks by never letting the instance getting garbage collected.Closes #5670
- Pyreverse - add output in mermaid-js format and html which is an mermaid js diagram with html boilerplate
DocstringParameterChecker
- Fixed incorrect classification of Numpy-style docstring as Google-style docstring for docstrings with property setter documentation. Docstring classification is now based on the highest amount of matched sections instead of the order in which the docstring styles were tried.
DocStringStyleChecker
Disable checker
bad-docstring-quotes
for Python <= 3.7, because in these versions the line numbers for decorated functions and classes are not reliable which interferes with the checker.Closes #3077
Fixed crash from
arguments-differ
andarguments-renamed
when methods were defined outside the top level of a class.Closes #5648
Fixed false positive
consider-using-dict-comprehension
when creating a dict using a list of tuples where key AND value vary depending on the same condition.Closes #5588
- When run in parallel mode
pylint
now pickles the data passed to subprocesses with thedill
package. Thedill
package has therefore been added as a dependency. Fixed false positive for
global-variable-undefined
whenglobal
is used with a class nameCloses #3088
Fixed crash on properties and inherited class methods when comparing them for equality against an empty dict.
Closes #5646
By default, pylint does no longer take files starting with
.#
into account. Those are considered emacs file locks. This behavior can be reverted by redefining theignore-patterns
option.Closes #367
Fix
super-init-not-called
when parent orself
is aProtocol
Closes #4790
An astroid issue where symlinks were not being taken into account was fixed
Closes #1470 Closes #3499 Closes #4302 Closes #4798 Closes #5081
Fixed extremely long processing of long lines with comma's.
Closes #5483
Fix false positive
super-init-not-called
for classes that inherit theirinit
from a parent.Closes #4941
Fix
unnecessary_dict_index_lookup
false positive when deleting a dictionary's entry.Closes #4716
Fix a crash in
unused-private-member
checker when analyzing code usingtype(self)
in bound methods.Closes #5569
Fix crash in
unnecessary-dict-index-lookup
checker if the output ofitems()
is assigned to a 1-tuple.Closes #5504
Fixed crash with slots assignments and annotated assignments.
Closes #5479
Fix false negative for
consider-iterating-dictionary
during membership checks encapsulated in iterables ornot in
checksCloses #5323
Fix false positive for
undefined-variable
whennamedtuple
class attributes are used as return annotations.Closes #5568
used-before-assignment
now considers that assignments in a try block may not have occurred when the except or finally blocks are executed.Closes #85, #2615
Fixed false negative for
used-before-assignment
when a conditional or context manager intervened before the try statement that suggested it might fail.Closes #4045
- Fixed false negative for
used-before-assignment
in finally blocks if an except handler did not define the assignment that might have failed in the try block. Fix a false positive for
assigning-non-slot
when the slotted class defined__setattr__
.Closes #3793
Fixed false positive for
used-before-assignment
with self-referential type annotation in conditional statements within class methods.Closes #5499
used-before-assignment
now assumes that assignments in except blocks may not have occurred and warns accordingly.Closes #4761
When evaluating statements after an except block,
used-before-assignment
assumes that assignments in the except blocks took place if the corresponding try block contained a return statement.Closes #5500
used-before-assignment
now checks names in try blocks.Fixed false positive with
used-before-assignment
for assignment expressions in lambda statements.Closes #5360, #3877
Fixed a false positive (affecting unreleased development) for
used-before-assignment
involving homonyms between filtered comprehensions and assignments in except blocks.Closes #5586
Fixed crash on list comprehensions that used
type
as inner variable name.Closes #5461
Fix false positive for
unused-variable
for a comprehension variable matching an outer scope type annotation.Closes #5326
Require Python
3.6.2
to run pylint.Closes #5065
- Fixed crash on uninferable decorators on Python 3.6 and 3.7
Emit
redefined-outer-name
when a nested except handler shadows an outer one.Closes #4434 Closes #5370
encoding
can now be supplied as a positional argument to calls that open files without triggeringunspecified-encoding
.Closes #5638
Fatal errors now emit a score of 0.0 regardless of whether the linted module contained any statements
Closes #5451
fatal
was added to the variables permitted in score evaluation expressions.The default score evaluation now uses a floor of 0.
Closes #2399
Fix
comparison-with-callable
false positive for callables that raise, such as typing constants.Closes #5557
When invoking
pylint
,epylint
,symilar
orpyreverse
by importing them in a python file you can now pass anarguments
keyword besides patchingsys.argv
.Closes #5320
- The
PyLinter
class will now be initialized with aTextReporter
as its reporter if none is provided. Fix false positive
not-callable
with attributes that aliasNamedTuple
Partially closes #1730
- The
testutils
for unittests now acceptend_lineno
andend_column
. Tests without these will trigger aDeprecationWarning
. Fixed false positive
unexpected-keyword-arg
for decorators.Closes #258
missing-raises-doc
will now check the class hierarchy of the raised exceptionsdef my_function() """My function. Raises: Exception: if something fails """ raise ValueError
Closes #4955
Fixed false positive for
unused-variable
when anonlocal
name is assigned as part of a multi-name assignment.Closes #3781
Fixed false positive for
global-variable-not-assigned
when thedel
statement is usedCloses #5333