Version 0.10.0 aka The Great Compare
This release is mostly targeted at writing better compares and conditions.
We introduce a lot of new rules related to this topic improving:
consistency, complexity, and general feel from your code.
In this release we have ported a lot of existing pylint
rules,
big cudos to the developers of this wonderful tool.
Features
- Adds
flake8-executable
as a dependency - Adds
flake8-rst-docstrings
as a dependency - Validates options that are passed with
flake8
- Forbids to use module level mutable constants
- Forbids to over-use strings
- Forbids to use
breakpoint
function - Limits yield tuple lengths
- Forbids to have too many
await
statements - Forbids to subclass lowercase
builtins
- Forbids to have useless
lambda
s - Forbids to use
len(sized) > 0
andif len(sized)
style checks - Forbids to use repeatable conditions:
flag or flag
- Forbids to write conditions like
not some > 1
- Forbids to use heterogenous compares like
x == x > 0
- Forbids to use complex compare with several items (
>= 3
) - Forbids to have class variables that are shadowed by instance variables
- Forbids to use ternary expressions inside
if
conditions - Forces to use ternary instead of
... and ... or ...
expression - Forces to use
c < b < a
instead ofa > b and b > c
- Forces to use
c < b < a
instead ofa > b > c
- Forbids to use explicit
in []
andin ()
, use sets or variables instead - Forces to write
isinstance(some, (A, B))
instead ofisinstance(some, A) or isinstance(some, B)
- Forbids to use
isinstance(some (A,))
- Forces to merge
a == b or a == c
intoa in {b, c}
and
to mergea != b and a != c
intoa not in {b, c}
Bugfixes
- Fixes incorrect line number for
Z331
- Fixes that
Z311
was not raising for multiplenot in
cases - Fixes a bunch of bugs for rules working with
Assign
and notAnnAssign
- Fixes that
continue
was not triggeringUselessReturningElseViolation
Misc
- Renames
logics/
tologic/
since it is grammatically correct - Renames
Redundant
toUseless
- Renames
Comparison
toCompare
- Renames
WrongConditionalViolation
toConstantConditionViolation
- Renames
ComplexDefaultValuesViolation
toComplexDefaultValueViolation
- Refactors
UselessOperatorsVisitor
- Adds
compat/
package, getting ready forpython3.8
- Adds
Makefile
- A lot of minor dependency updates