This release was focused on adding python3.8
support,
removing dependencies that can be removed, and fixing bugs.
There are breaking changes ahead!
We also have this nice migration guide.
One more thing: flake8
still fails on :=
operator.
And there's nothing we can do about it.
Please, be patient – this linter does not allow to have :=
in the source code anyway!
Features
- Breaking: removes
flake8-executable
, now usingWPS452
instead ofEXE001..EXE005
- Breaking: removes
flake8-print
, now usingWPS421
instead ofT001
- Breaking: removes
flake8-builtins
, now usingWPS125
instead ofA001..A005
- Breaking: removes
flake8-annotations-complexity
,
now usingWPS234
instead ofTAE002
- Breaking: removes
flake8-pep3101
, now usingWPS323
instead ofS001
,
we also use a new logic for this violation:
we check string defs for%
patterns, and not for%
operator - Breaking:
WPS441
is no longer triggered forexcept
blocks,
it is now handled byF821
fromflake8
- Breaking: removes
radon
,
becausecognitive-complexity
andmccabe
is enough - Breaking: removes
flake8-loggin-format
as a direct dependency - Breaking: removes
ImplicitTernaryViolation
orWPS332
,
because it has too many false positives #1099 - Removes
flake8-coding
, all encoding strings, visitor and tests
for oldWPS323
which is now reused for modulo formatting checks - Adds
python3.8
support - Changes
styleguide.toml
andflake8.toml
scripts definition - Extracts new violation -
WPS450
fromWPS436
#1118 - Adds domain names options:
--allowed-domain-names
and--forbidden-domain-names
,
that are used to create variable names' blacklist #1106 - Forbids to use
\r
(carriage return) as line breaks in strings #1111 - Forbids to use
:=
operator, it now reusesWPS332
code - Forbids to use positional only
/
arguments - Forbids to have too many names imported from a single
from ... import
- Forbids to use
continue
andbreak
infinally
- Forbids to use
__reduce__
and__reduce_ex__
magic methods - Adds
__call__
to list of methods that should be on top #1125 - Allows
_
to be now used as a defined variable - Removes
cognitive_complexity
dependency, now it is built in into our linter - Adds baseline information for all complexity violation messages:
x > baseline
- Changes how cognitive complexity is calculated
- Adds support for positional arguments in different checks
- Adds
UnreadableNameViolation
asWPS124
because there are some
character combination which is not easy to read - Adds support for
NamedExpr
with in compare type violation
Bugfixes
- Fixes how
i_control_code
behaves withWPS113
- Fixes that cognitive complexity was ignoring
ast.Continue
,ast.Break
, andast.Raise
statements - Fixes that cognitive complexity was ignoring
ast.AsyncFor
loops - Fixes that annotation complexity was not reported for
async
functions - Fixes that annotation complexity was not reported for lists
- Fixes that annotation complexity was not reported for
*
and/
args - Fixes that annotation complexity was not tested for dot notation attributes
- Fixes that annotation complexity fails on string expressions
- Fixes bug when
TooManyPublicAttributesViolation
was counting duplicate fields - Fixes negated conditions
WPS504
was not reported forif
expressions - Fixes that
import dumps
was reported asWPS347
,
now onlyfrom ... import dumps
is checked - Fixes that
from some import a as std
was reported as a vague import
withWPS347
despite having a meaningful alias - Fixes that
WPS501
was reported for@contextmanager
definition - Fixes
WPS226
to be thrown at nested string type annotations - Fixes
WPS204
reported simplest nodes as overused like[]
andcall()
- Fixes
WPS204
not reporting overusedf
strings - Fixes
WPS204
reporting overused return type annotations - Fixes
WPS204
reportingself.
attribute access - Fixes
WPS331
reporting cases that do require some extra steps before return - Fixes
WPS612
not reporingsuper()
calls without return - Fixes
WPS404
not raising on wrong*
and/
defaults - Fixes
WPS425
raising on.get
,getattr
,setattr
,
and other builtin functions without keyword arguments - Fixes
WPS221
reporting differently on differentpython
versions - Fixes
WPS221
reporting nested variable annotations - Fixes
WPS509
not reporting nested ternary in grandchildren ofif
- Fixes
WPS509
not reporting nested ternary in ternary - Fixes
WPS426
not reporting nestedlambda
in comprehensions - Fixes several violations to reporting for
ast.Bytes
andast.FormattedStr
whereast.Str
was checked - Fixes
WPS601
reporting shadowing for non-self
attributes - Fixes
WPS114
not to be so strict - Fixes
WPS122
not raising forfor
andasync for
definitions - Fixes
WPS400
raising for# type: ignore[override]
comments - Fixes
WPS115
not raising for attributes inside other nodes
Misc
- Changes how tests are executed
- Changes how coverage is calculated, adds
coverage-conditional-plugin
- Adds how a violation can be deprecated
- Improves old visitor tests with
/
argument cases - Improves old visitor tests with
:=
cases - Adds
local-partial-types
to mypy config - Uses
abc
stdlib's module to mark abstract base classes #1122 - Adds
python3.8
to the CI - Updates a lot of dependencies