mirror of
https://fuchsia.googlesource.com/third_party/github.com/pylint-dev/pylint
synced 2024-09-21 16:19:21 +00:00
4714a65529
This commit reduce the scope of `len-as-condition` to only care when a `len(SEQUENCE)` call is made without an explicit comparison, as stated in PEP8.
61 lines
1.3 KiB
ReStructuredText
61 lines
1.3 KiB
ReStructuredText
**************************
|
|
What's New in Pylint 2.4
|
|
**************************
|
|
|
|
:Release: 2.4
|
|
:Date: TBA
|
|
|
|
|
|
Summary -- Release highlights
|
|
=============================
|
|
|
|
|
|
New checkers
|
|
============
|
|
|
|
* A new check ``class-variable-slots-conflict`` was added.
|
|
|
|
This check is emitted when ``pylint`` finds a class variable that conflicts with a slot
|
|
name, which would raise a ``ValueError`` at runtime.
|
|
|
|
For example, the following would raise an error::
|
|
|
|
class A:
|
|
__slots__ = ('first', 'second')
|
|
first = 1
|
|
|
|
|
|
Other Changes
|
|
=============
|
|
|
|
* ``len-as-condition`` now only fires when a ``len(x)`` call is made without an explicit comparison.
|
|
|
|
The message and description accompanying this checker has been changed
|
|
reflect this new behavior, by explicitly asking to either rely on the
|
|
fact that empty sequence are false or to compare the length with a scalar.
|
|
|
|
OK::
|
|
|
|
if len(x) == 0:
|
|
pass
|
|
|
|
while not len(x) == 0:
|
|
pass
|
|
|
|
assert len(x) > 5, message
|
|
|
|
KO::
|
|
|
|
if not len(x):
|
|
pass
|
|
|
|
while len(x) and other_cond:
|
|
pass
|
|
|
|
assert len(x), message
|
|
|
|
* A file is now read from stdin if the ``--from-stdin`` flag is used on the
|
|
command line. In addition to the ``--from-stdin`` flag a (single) file
|
|
name needs to be specified on the command line, which is needed for the
|
|
report.
|