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 kudos 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` and `if len(sized)` style checks
- Forbids to use repeatable conditions: `flag or flag`
- Forbids to write conditions like `not some > 1`
- Forbids to use heterogeneous 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 of `a > b and b > c`
- Forces to use `c < b < a` instead of `a > b > c`
- Forbids to use explicit `in []` and `in ()`, use sets or variables instead
- Forces to write `isinstance(some, (A, B))`
instead of `isinstance(some, A) or isinstance(some, B)`
- Forbids to use `isinstance(some (A,))`
- Forces to merge `a == b or a == c` into `a in {b, c}` and
to merge `a != b and a != c` into `a not in {b, c}`
Bugfixes
- Fixes incorrect line number for `Z331`
- Fixes that `Z311` was not raising for multiple `not in` cases
- Fixes a bunch of bugs for rules working with `Assign` and not `AnnAssign`
- Fixes that `continue` was not triggering `UselessReturningElseViolation`
Misc
- Renames `logics/` to `logic/` since it is grammatically correct
- Renames `Redundant` to `Useless`
- Renames `Comparison` to `Compare`
- Renames `WrongConditionalViolation` to `ConstantConditionViolation`
- Renames `ComplexDefaultValuesViolation` to `ComplexDefaultValueViolation`
- Refactors `UselessOperatorsVisitor`
- Adds `compat/` package, getting ready for `python3.8`
- Adds `Makefile`
- A lot of minor dependency updates