Releases: pylint-dev/pylint
v2.15.3
-
Fixed a crash in the
unhashable-member
checker when using alambda
as a dict key.Closes #7453
-
Fix a crash in the
modified-iterating-dict
checker involving instance attributes.Closes #7461
-
invalid-class-object
does not crash anymore when__class__
is assigned alongside another variable.Closes #7467
-
Fix false positive for
global-variable-not-assigned
when a global variable is re-assigned via anImportFrom
node.Closes #4809
-
Fix false positive for
undefined-loop-variable
infor-else
loops that use a function
having a return type annotation ofNoReturn
orNever
.Closes #7311
-
--help-msg
now accepts a comma-separated list of message IDs again.Closes #7471
v2.15.2
-
Fixed a case where custom plugins specified by command line could silently fail.
Specifically, if a plugin relies on the
init-hook
option changingsys.path
before
it can be imported, this will now emit abad-plugin-value
message. Before this
change, it would silently fail to register the plugin for use, but would load
any configuration, which could have unintended effects.Fixes part of #7264.
-
Fix
used-before-assignment
for functions/classes defined in type checking guard.Closes #7368
-
Update
modified_iterating
checker to fix a crash withfor
loops on empty list.Closes #7380
-
The
docparams
extension now considers typing in Numpy style docstrings
as "documentation" for themissing-param-doc
message.Refs #7398
-
Fix false positive for
unused-variable
andunused-import
when a name is only used in a string literal type annotation.Closes #3299
-
Fix false positive for
too-many-function-args
when a function call is assigned to a class attribute inside the class where the function is defined.Closes #6592
-
Fix
used-before-assignment
for functions/classes defined in type checking guard.Closes #7368
-
Fix ignored files being linted when passed on stdin.
Closes #4354
-
missing-return-doc
,missing-raises-doc
andmissing-yields-doc
now respect
theno-docstring-rgx
option.Closes #4743
-
Don't crash on
OSError
in config file discovery.Closes #7169
-
disable-next
is now correctly scoped to only the succeeding line.Closes #7401
-
Update
modified_iterating
checker to fix a crash withfor
loops on empty list.Closes #7380
v2.15.1
-
Fix
used-before-assignment
for functions/classes defined in type checking guard.Closes #7368
-
Update
modified_iterating
checker to fix a crash withfor
loops on empty list.Closes #7380
-
The
docparams
extension now considers typing in Numpy style docstrings
as "documentation" for themissing-param-doc
message.Refs #7398
-
Fix false positive for
unused-variable
andunused-import
when a name is only used in a string literal type annotation.Closes #3299
-
Fix false positive for
too-many-function-args
when a function call is assigned to a class attribute inside the class where the function is defined.Closes #6592
-
Fix
used-before-assignment
for functions/classes defined in type checking guard.Closes #7368
-
Fix ignored files being linted when passed on stdin.
Closes #4354
-
missing-return-doc
,missing-raises-doc
andmissing-yields-doc
now respect
theno-docstring-rgx
option.Closes #4743
-
Don't crash on
OSError
in config file discovery.Closes #7169
-
disable-next
is now correctly scoped to only the succeeding line.Closes #7401
-
Update
modified_iterating
checker to fix a crash withfor
loops on empty list.Closes #7380
v2.15.0
In pylint 2.15.0, we added a new check missing-timeout
to warn of default timeout values that could cause a program to be hanging indefinitely.
We improved pylint
's handling of namespace packages. More packages should be linted without resorting to using the --recursive=y
option.
We still welcome any community effort to help review, integrate, and add good/bad examples to the doc for #5953. This should be doable without any pylint
or astroid
knowledge, so this is the perfect entrypoint if you want to contribute to pylint
or open source without any experience with our code!
Internally, we changed the way we generate the release notes, thanks to DudeNr33. There will be no more conflict resolution to do in the changelog, and every contributor rejoice.
Marc Byrne became a maintainer, welcome to the team !
New Checks
-
Added new checker
missing-timeout
to warn of default timeout values that could cause
a program to be hanging indefinitely.Refs #6780
False Positives Fixed
-
Don't report
super-init-not-called
for abstract__init__
methods.Closes #3975
-
Don't report
unsupported-binary-operation
on Python <= 3.9 when using the|
operator
with types, if one has a metaclass that overloads__or__
or__ror__
as appropriate.Closes #4951
-
Don't report
no-value-for-parameter
for dataclasses fields annotated withKW_ONLY
.Closes #5767
-
Fixed inference of
Enums
when they are imported under an alias.Closes #5776
-
Prevent false positives when accessing
PurePath.parents
by index (not slice) on Python 3.10+.Closes #5832
-
unnecessary-list-index-lookup
is now more conservative to avoid potential false positives.Closes #6896
-
Fix double emitting
trailing-whitespace
for multi-line docstrings.Closes #6936
-
import-error
now correctly checks forcontextlib.suppress
guards on import statements.Closes #7270
-
Fix false positive for
no-self-argument
/no-method-argument
when a staticmethod is applied to a function but uses a different name.Closes #7300
-
Fix
undefined-loop-variable
withbreak
andcontinue
statements inelse
blocks.Refs #7311
False Negatives Fixed
-
Emit
used-before-assignment
when relying on a name that is reimported later in a function.Closes #4624
-
Emit
used-before-assignment
for self-referencing named expressions (:=
) lacking
prior assignments.Closes #5653
-
Emit
used-before-assignment
for self-referencing assignments under if conditions.Closes #6643
-
Emit
modified-iterating-list
and analogous messages for dicts and sets when iterating
literals, or when using thedel
keyword.Closes #6648
-
Emit
used-before-assignment
when calling nested functions before assignment.Closes #6812
-
Emit
nonlocal-without-binding
when a nonlocal name has been assigned at a later point in the same scope.Closes #6883
-
Emit
using-constant-test
when testing the truth value of a variable or call result
holding a generator.Closes #6909
-
Rename
unhashable-dict-key
tounhashable-member
and emit when creating sets and dicts,
not just when accessing dicts.
Other Bug Fixes
-
Fix a failure to lint packages with
__init__.py
contained in directories lacking__init__.py
.Closes #1667
-
Fixed a syntax-error crash that was not handled properly when the declared encoding of a file
wasutf-9
.Closes #3860
-
Fix a crash in the
not-callable
check when there is ambiguity whether an instance is being incorrectly provided to__new__()
.Closes #7109
-
Fix crash when regex option raises a
re.error
exception.Closes #7202
-
Fix
undefined-loop-variable
from walrus in comprehension test.Closes #7222
-
Check for
<cwd>
before removing first item fromsys.path
inmodify_sys_path
.Closes #7231
-
Fix sys.path pollution in parallel mode.
Closes #7246
-
Prevent
useless-parent-delegation
for delegating to a builtin
written in C (e.g.Exception.__init__
) with non-self arguments.Closes #7319
Other Changes
-
bad-exception-context
has been renamed tobad-exception-cause
as it is about the cause and not the context.Closes #3694
-
The message for
literal-comparison
is now more explicit about the problem and the
solution.Closes #5237
-
useless-super-delegation
has been renamed touseless-parent-delegation
in order to be more generic.Closes #6953
-
Pylint now uses
towncrier
for changelog generation.Refs #6974
-
Update
astroid
to 2.12.Refs #7153
-
Fix crash when a type-annotated
__slots__
with no value is declared.Closes #7280
Internal Changes
-
Fixed an issue where it was impossible to update functional tests output when the existing
output was impossible to parse. Instead of raising an error we raise a warning message and
let the functional test fail with a default value.Refs #6891
-
pylint.testutils.primer
is now a private API.Refs #6905
-
We changed the way we handle the changelog internally by using towncrier.
If you're a contributor you won't have to fix merge conflicts in the
changelog anymore.Closes #6974
-
Pylint is now using Scorecards to implement security recommendations from the
OpenSSF <https://openssf.org/>
_. This is done in order to secure our supply chains using a combination
of automated tooling and best practices, most of which were already implemented before.Refs #7267
v2.14.5
-
Fixed a crash in the
undefined-loop-variable
check whenenumerate()
is used
in a ternary expression.Closes #7131
-
Fixed handling of
--
as separator between positional arguments and flags.Closes #7003
-
Fixed the disabling of
fixme
and its interaction withuseless-suppression
. -
Allow lists of default values in parameter documentation for
Numpy
style.Closes #4035
v2.14.4
-
The
differing-param-doc
check was triggered by positional only arguments.Closes #6950
-
Fixed an issue where scanning
.
directory recursively with--ignore-path=^path/to/dir
is not
ignoring thepath/to/dir
directory.Closes #6964
-
Fixed regression that didn't allow quoted
init-hooks
in option files.Closes #7006
-
Fixed a false positive for
modified-iterating-dict
when updating an existing key.Closes #6179
-
Fixed an issue where many-core Windows machines (>~60 logical processors) would hang when
using the default jobs count.Closes #6965
-
Fixed an issue with the recognition of
setup.cfg
files.
Only.cfg
files that are exactly namedsetup.cfg
require section names that
start withpylint.
.Closes #3630
-
Don't report
import-private-name
for relative imports.Closes #7078
v2.14.3
-
Fixed two false positives for
bad-super-call
for calls that refer to a non-direct parent. -
Fixed a false positive for
useless-super-delegation
for subclasses that specify the number of
of parameters against a parent that uses a variadic argument.Closes #2270
-
Allow suppressing
undefined-loop-variable
andundefined-variable
without raisinguseless-suppression
. -
Fixed false positive for
undefined-variable
for__class__
in inner methods.Closes #4032
v2.14.2
-
Fixed a false positive for
unused-variable
when a function returns an
argparse.Namespace
object.Closes #6895
-
Avoided raising an identical
undefined-loop-variable
message twice on the same line. -
Don't crash if
lint.run._query_cpu()
is run within a Kubernetes Pod, that has only
a fraction of a cpu core assigned. Just go with one process then.Closes #6902
-
Fixed a false positive in
consider-using-f-string
if the left side of a%
is not a string.Closes #6689
-
Fixed a false positive in
unnecessary-list-index-lookup
andunnecessary-dict-index-lookup
when the subscript is updated in the body of a nested loop.Closes #6818
-
Fixed an issue with multi-line
init-hook
options which did not record the line endings.Closes #6888
-
Fixed a false positive for
used-before-assignment
when a try block returns
but an except handler defines a name via type annotation. -
--errors-only
no longer enables previously disabled messages. It was acting as
"emit all and only error messages" without being clearly documented that way.Closes #6811
v2.14.1
-
Avoid reporting
unnecessary-dict-index-lookup
orunnecessary-list-index-lookup
when the index lookup is part of a destructuring assignment.Closes #6788
-
Fixed parsing of unrelated options in
tox.ini
.Closes #6800
-
Fixed a crash when linting
__new__()
methods that return a call expression.Closes #6805
-
Don't crash if we can't find the user's home directory.
Closes #6802
-
Fixed false positives for
unused-import
when aliasingtyping
e.g. ast
and guarding imports undert.TYPE_CHECKING
.Closes #3846
-
Fixed a false positive regression in 2.13 for
used-before-assignment
where it is safe to rely
on a name defined only in anexcept
block because theelse
block returned.Closes #6790
-
Fixed the use of abbreviations for some special options on the command line.
Closes #6810
-
Fix a crash in the optional
pylint.extensions.private_import
extension.Closes #6624
-
bad-option-value
(E0012) is now a warningunknown-option-value
(W0012). Deleted messages that do not exist
anymore in pylint now raiseuseless-option-value
(R0022) instead ofbad-option-value
. This allows to
distinguish between genuine typos and configuration that could be cleaned up. Existing message disables for
bad-option-value
will still work on both new messages.Refs #6794
v3.0.0-a5
This is 2.14.0 with breaking changes for 3.0 included. Released only so that the old alpha 4 release based on pylint 2.9.0 is not proposed by tools instead of 2.14.0. 2.14.0 is the stable version you should use that.