Version 0.14.0 aka The Walrus fighter

Published on March 25, 2020 by Nikita Sobolev

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 0.14 migration guide.

Features

  • Breaking: removes flake8-executable, now using WPS452 instead of EXE001..EXE005
  • Breaking: removes flake8-print, now using WPS421 instead of T001
  • Breaking: removes flake8-builtins, now using WPS125 instead of A001..A005
  • Breaking: removes flake8-annotations-complexity, now using WPS234 instead of TAE002
  • Breaking: removes flake8-pep3101, now using WPS323 instead of S001, 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 for except blocks, it is now handled by F821 from flake8
  • Breaking: removes radon, because cognitive-complexity and mccabe is enough
  • Breaking: removes flake8-loggin-format as a direct dependency
  • Breaking: removes ImplicitTernaryViolation or WPS332, because it has too many false positives #1099
  • Removes flake8-coding, all encoding strings, visitor and tests for old WPS323 which is now reused for modulo formatting checks
  • Adds python3.8 support
  • Changes styleguide.toml and flake8.toml scripts definition
  • Extracts new violation - WPS450 from WPS436 #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 reuses WPS332 code
  • Forbids to use positional only / arguments
  • Forbids to have too many names imported from a single from ... import
  • Forbids to use continue and break in finally
  • 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 as WPS124 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 with WPS113
  • Fixes that cognitive complexity was ignoring ast.Continue, ast.Break, and ast.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 for if expressions
  • Fixes that import dumps was reported as WPS347, now only from ... import dumps is checked
  • Fixes that from some import a as std was reported as a vague import with WPS347 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 [] and call()
  • Fixes WPS204 not reporting overused f strings
  • Fixes WPS204 reporting overused return type annotations
  • Fixes WPS204 reporting self. attribute access
  • Fixes WPS331 reporting cases that do require some extra steps before return
  • Fixes WPS612 not reporing super() 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 different python versions
  • Fixes WPS221 reporting nested variable annotations
  • Fixes WPS509 not reporting nested ternary in grandchildren of if
  • Fixes WPS509 not reporting nested ternary in ternary
  • Fixes WPS426 not reporting nested lambda in comprehensions
  • Fixes several violations to reporting for ast.Bytes and ast.FormattedStr where ast.Str was checked
  • Fixes WPS601 reporting shadowing for non-self attributes
  • Fixes WPS114 not to be so strict
  • Fixes WPS122 not raising for for and async 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