Skip to content

Releases: wemake-services/wemake-python-styleguide

Version 0.15.0 aka python3.9

09 Feb 08:05
e6afb85
Compare
Choose a tag to compare

Features

  • Adds python3.9 support
  • Forbids to use new-style decorators on python3.9
  • Changes how we treat own/foreign attributes,
    since now we only check assigned attribute names for self/cls/mcs,
    but not any other ones.
    So, now writting point.x = 1 will not trigger any violations.
    Previously, it would raise "too short name".
  • Forbids using non-trivial expressions as an argument to except
  • Forbids using too many variables in a tuple unpacking
  • Forbids using float("NaN").
  • Forbids assigning to a slice
  • Allow __call__ method to be asynchronous
  • Allows common strings not to be counted against string constant overuse limit
  • Forbids to unpack iterable objects to lists #1259
  • Forbids to use single return None
  • Add __await__ to the list of priority magic methods
  • Forbids to use float zeros (0.0)
  • Forbids raise Exception and raise BaseException
  • Forbids to use % with zero as the divisor
  • WPS531: Forbids testing conditions to just return booleans when it is possible to simply return the condition itself
  • Forbids to use unsafe infinite loops
  • Forbids to use raw strings r'' when not necessary
  • Forbids to use too complex f-strings
  • Forbids to use too many raise statements inside a single function
  • Forbids to compare with float and complex values
  • Forbids single element destruct
  • Forbids to ignore some violations (configurable) on a line level
  • Forbids single element unpacking
  • Forbids to unpack lists with side-effects
  • Forbids to use miltiline strings except for assignments and docstrings
  • Forbids not returning anything in functions and methods starting with get_
  • Forbids to use empty comment
  • Forbids using bitwise operation with boolean operation
  • Forbids inconsistent structuring of multiline comprehensions
  • Forbids to use unpythonic getters and setters such as get_attribute or set_attribute
  • Now credits, license, and copyright builtins are free to shadow

Bugfixes

  • Fixes fails of annotation complexity on Literal[""]
  • Fixes how wrong variable names were checked case sensitive with WPS110
  • Fixes false positives DirectMagicAttributeAccessViolation with __mro__, __subclasses__ and __version__
  • Make WPS326 work when there is comment between string literals
  • Allowed yield statements in call method
  • Allow to use ^ with 1
  • Fixes false positives in WPS513 and WPS323
  • Fixes false positive WPS426 if lambda in loop uses only its arguments
  • Fixes false negative WPS421 with pprint.pprint
  • Fixes WPS441 triggering when reusing variable names in multiple loops
  • Fixes false positive ImplicitEnumerateViolation on range with step #1742
  • Allows to use _ to declare several unused variables,
    like: x, _, _ = coordinates()
  • Fixes variable reassignment in class context
  • Fixes that *'abc' was not counted as pointless star expression
  • Fixes that -some was counted as overused expression
  • Fixes several bugs with attribute names

Misc

  • Updates lots of dependenices
  • Fixed documentation for TooManyPublicAttributesViolation
  • Updated isort config
  • Introduce helper script to check for missing calls to self.generic_visit(node) in AST visitors
  • Updates poetry version to 1.1
  • Updates reviewdog version to 0.11.0 and adds action-depup

Version 0.14.1 aka The broken release process

29 Jul 16:50
8068e66
Compare
Choose a tag to compare

Version 0.14.0 aka The Walrus fighter

22 Mar 17:19
a0e4107
Compare
Choose a tag to compare

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 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

Version 0.13.4

19 Jan 10:53
cde06d6
Compare
Choose a tag to compare

This is the last 0.13.x supporting release,
we have to concentrate on python3.8 support
and 0.14.0 which will introduce it to the public.

Bugfixes

  • Fix false positive ImplicitYieldFromViolation for async functions #1057
  • Fixes nested-classes-whitelist option default value for flake8 prior 3.7.8 #1093
  • Improve boolean non-keyword arguments validation #1114

Misc

  • Updates flake8-pep3101
  • Updates flake8-builtins
  • Updates flake8-eradicate
  • Several small refactoring sessions
  • Adds hypothesis-based tests
  • Adds flakehell base config
  • Fixes flakehell docs
  • Fixes MAX_NOQA_COMMENTS and related violation docs
  • Fixes OverusedExpressionViolation and TooManyExpressionsViolation docs

Version 0.13.3

15 Dec 12:03
d4f3b08
Compare
Choose a tag to compare

Misc

  • Updates radon version
  • Updates poetry version to 1.0

Version 0.13.2

10 Dec 12:51
6b24f1f
Compare
Choose a tag to compare

Bugfixes

  • Fixes that Github Action was failing for wrong status code
  • Fixes NegatedConditionsViolation false positive on absent
    else in combination with elif
  • Fixes WPS528 false positive on augmented assigns
  • Fixes incorrect message for WPS349
  • Fixes that reviewdog was not able to create more than 30 comments per PR

Misc

  • pylint docs fixed
  • Fixes docs about implicit yield violation

Version 0.13.1

26 Nov 13:00
cfee4b1
Compare
Choose a tag to compare

Bufixes

  • Fixes that _ was marked as invalid by VagueImportViolation
  • Fixes that docs for VagueImportViolation were misleading
  • Fixes invalid docs for BracketBlankLineViolation #1020
  • Add more complex example to ParametersIndentationViolation #1021

Misc

  • Now our GitHub Action can be used to leave PR review comments

0.13.0 aka The Lintoberfest

18 Nov 08:33
4eba400
Compare
Choose a tag to compare

This is a huge release that was created during the Hactoberfest season.
It would have been impossible without the huge help from our awesome contributors. Thanks a lot to everyone!

This release is not focused on any particular area.
It features a lot of new rules from different categories.

Features

  • Adds cognitive complexity metric, introduced by cognitive_complexity
  • Adds docstrings linter darglint
  • Updates pep8-naming and flake8-comprehensions
  • WPS431 now allow customize whitelist via nested-classes-whitelist setting
  • Forbids to have invalid strings in stared expressions like **{'@': 1}
  • Forbids to use implicit primitive values in a form of lambda: 0
  • Forbids to use approximate math constants
  • Forbids to redefine string constants
  • Forbids use of vague import names (e.g. from json import loads)
  • Makes OveruseOfNoqaCommentViolation configurable via --max-noqa-comments
  • Forbid incorrectly swapped variables
  • Forbids to use redundant subscripts (e.g., [0:7] or [3:None])
  • Allows super() as a valid overused expression
  • Forbids to use super() with other methods and properties
  • WPS350 enforces using augmented assign pattern
  • Forbids unnecessary literals
  • WPS525 forbids comparisons where in is compared with single item container
  • Forbids wrong annotations in assignment
  • Forbids using multiline for and while statements
  • WPS113 now can be tweaked with I_CONTROL_CODE setting
  • Adds WPS000 that indicates internal errors
  • Forbids to use implicit yield from
  • Forbids to start lines with .
  • Enforces better &, |, >>, <<, ^ operators usage
  • Forbids incorrect exception order
  • Enforces tuples usage with frozenset constructor
  • Changes how WPS444 works, now we use stricter logic for while and assert
  • Forbids to use yield from with incorrect types
  • Forbids to use consecutive yield expressions
  • Enforces to use .items() in loops
  • Enforces using .get() over key in dict checks
  • Forbids to use and declare float keys in arrays and dictionaries
  • Forbids to use a[len(a) - 1] because it is just a[-1]
  • Forbids too long call chains like foo(a)(b)(c)(d)

Bugfixes

  • Fixes ImplicitElifViolation false positives on a specific edge cases
  • Fixes --i-control-code setting for BadMagicModuleFunctionViolation
  • Fixes compatibility with flake8 3.8.x
  • Fixes that not not True was not detected as WPS330
  • Fixes addition of MisrefactoredAssignmentViolation check
  • Fixes WrongMagicCommentViolation not catching certain wrong comments
  • Fixes BadMagicModuleFunctionViolation false positives on class-level methods
  • Fixes InconsistentReturnViolation false positives on nested functions
  • Fixes that --i-dont-control-code was not present in command line options
  • Fixes BlockVariableVisitor false positives on a properties
  • Fixes that // was not recognised as a math operation
  • Fixes false positive BlockAndLocalOverlapViolation on annotations without value assign
  • Fixes bug when x and not x was not detected as the similar conditions by WPS408
  • Fixed that 1.0 and 0.1 were treated as magic numbers

Misc

  • Improves Github Action stability
  • Replace scripts/tokens.py and scripts/parse.py with external tools
  • Improves violation code testing
  • Improves testing of .. versionchanged and previous_codes properties
  • Reference isort settings requirement for compliance with WSP318 in docstring
  • Improves tests: we now ensure that each violation with previous codes also
    has corresponding versions changed in their documentation

Version 0.12.5

19 Sep 14:14
648ff19
Compare
Choose a tag to compare

Bugfixes

  • We now ignore @overload from BlockAndLocalOverlapViolation
  • Now expressions that reuse block variables are not treated as violations,
    example: my_var = do_some(my_var)

Misc

  • Adds Github Action and docs how to use it
  • Adds local Github Action that uses itself for testing
  • Adds official Docker image and docs about it

Version 0.12.4

29 Aug 07:45
022143b
Compare
Choose a tag to compare

Bugfixes

  • Fixes bug with nitpick colors and new files API
  • Updates flake8-docstrings