Skip to content

Releases: wemake-services/wemake-python-styleguide

Version 0.13.3

15 Dec 12:03
d4f3b08

Choose a tag to compare

Misc

  • Updates radon version
  • Updates poetry version to 1.0

Version 0.13.2

10 Dec 12:51
6b24f1f

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

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

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

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

Choose a tag to compare

Bugfixes

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

Version 0.12.3

25 Aug 10:32
f52c98c

Choose a tag to compare

Bugfixes

  • Fixes that formatting was failing sometimes when colours were not available
  • Fixes that 1 / number was not allowed
  • Fixes that % operator was allowed for 0 and 1

Version 0.12.2

19 Aug 17:10
8fd4bff

Choose a tag to compare

Features

  • Adds reveal_type to the list of forbidden functions
  • WPS517 now allows to use non-string keys inside **{},
    so this is allowed: Users.objects.get(**{User.USERNAME_FIELD: username})

Bugfixes

  • Fixes that {**a, **b} was reported as duplicate hash items

Version 0.12.1

15 Aug 08:11
9105869

Choose a tag to compare

Bugfixes

  • Changes radon and pydocstyle versions for better resolution

Misc

  • Improves README.md with flakehell and nitpick mentions
  • Improves docs all accross the project

Version 0.12.0

14 Aug 17:42
c38647e

Choose a tag to compare

In this release we had a little focus on:

  1. Primitives and constants and how to use them
  2. Strings and numbers and how to write them
  3. OOP features
  4. Blocks and code structure,
    including variable scoping and overlaping variables
  5. Overused expressions and new complexity metrics

Features

  • Breaking: moves ImplicitInConditionViolation from WPS336 to WPS514
  • Breaking: now ExplicitStringConcatViolation uses WPS336
  • Breaking: moves YieldMagicMethodViolation from WPS435 to WPS611
  • Adds xenon as a dependency, it also checks for cyclomatic complexity,
    but uses more advanced algorithm with better results
  • Forbids to have modules with too many imported names
    configured by --max-imported-names option which is 50 by default
  • Forbids to raise StopIteration inside generators
  • Forbids to have incorrect method order inside classes
  • Forbids to make some magic methods async
  • Forbids to use meaningless zeros in float, binary, octal, hex,
    and expanentional numbers
  • Enforces to use 1e10 instead of 1e+10
  • Enforces to use big letters for hex numbers: 0xAB instead of 0xab
  • Enforces to use r'\n' instead of '\\n'
  • Forbids to have unicode escape characters inside binary strings
  • Forbids to use else if instead of elif
  • Forbids to have too long try bodies,
    basically try bodies with more than one statement
  • Forbids to overlap local and block variables
  • Forbids to use block variables after the block definitions
  • Changes how WrongSlotsViolation works, now (...) + value is restricted
    in favor of (..., *value)
  • Forbids to have explicit unhashable types in sets and dicts
  • Forbids to define useless overwritten methods
  • Enforces j prefix over J for complex numbers
  • Forbids overused expressions
  • Forbids explicit 0 division, multiply, pow, addition, and substraction
  • Fordids to pow, multiply, or divide by 1
  • Forbids to use expressions like x + -2, or y - -1, or z -= -1
  • Forbids to multiply lists like [0] * 2
  • Forbids to use variable names like __ and _____
  • Forbids to define unused variables explicitly: _unused = 2
  • Forbids to shadow outer scope variables with local ones
  • Forbids to have too many assert statements in a function
  • Forbids to have explicit string contact: 'a' + some_data, use .format()
  • Now YieldInsideInitViolation is named YieldMagicMethodViolation
    and it also checks different magic methods in a class
  • Forbids to use assert False and other false-constants
  • Forbids to use while False: and other false-constants
  • Forbids to use open() outside of with
  • Forbids to use type() for compares
  • Forbids to have consecutive expressions with too deep access level
  • Forbids to have too many public instance attributes
  • Forbids to use pointless star operations: print(*[])
  • Forbids to use range(len(some)), use enumerate(some) instead
  • Forbids to use implicit sum() calls and replace them with loops
  • Forbids to compare with the falsy constants like if some == []:

Bugfixes

  • Bumps flake8-eradicate version
    and solves attrs incompatible versions issue
  • Bumps flake8-dosctrings veresion
    and solved pydocstyle issue
  • Fixes TryExceptMultipleReturnPathViolation not tracking else and finally
    returns at the same time
  • Fixes how TryExceptMultipleReturnPathViolation works:
    now handles break and raise statements as well
  • Fixes WrongLoopIterTypeViolation not triggering
    for generator expressions and empty tuples
  • Fixes WrongLoopIterTypeViolation not triggering
    for numbers (including negative), booleans, None
  • Fixes WrongLoopIterTypeViolation position
  • Fixes WrongLoopIterTypeViolation not triggering for compehensions
  • Fixes WrongSlotsViolation not triggering
    for comprehensions and incorrect __slots__ names and types
  • Fixes WrongSlotsViolation not triggering
    for invalid python identifiers like __slots__ = ('123_slot',)
  • Fixes WrongSlotsViolation triggering for subscripts
  • Fixes NestedClassViolation and NestedFunctionViolation not reporting
    when placed deeply inside other nodes
  • Fixes when WrongUnpackingViolation was not raised
    for async for and async with nodes
  • Fixes when WrongUnpackingViolation was not raised for comprehensions
  • Fixes that x, y, z = x, z, y was not recognized
    as ReassigningVariableToItselfViolation
  • Fixes that {1, True, 1.0} was not recognised as a set with duplicates
  • Fixes that {(1, 2), (1, 2)} was not recognised as a set with duplicates
  • Fixes that {*(1, 2), *(1, 2)} was not recognised as a set with duplicates
  • Fixes that {1: 1, True: 1} was not recognised as a dict with duplicates
  • Fixes that complex numbers were always treated like magic,
    now 1j is allowed
  • Fixes that 0.0 was treated as a magic number
  • Fixes that it was possible to use _ in module body
  • Fixes WrongBaseClassViolation not triggering
    for nested nodes like class Test(call().length):
  • Fixes ComplexDefaultValueViolation not triggering
    for nested nodes like def func(arg=call().attr)
  • Fixes TooShortNameViolation was not triggering for _x and x_
  • Fixes that some magic method were allowed to be generators
  • Fixes that some magic method were allowed to contain yield from
  • Fixes bug when some correct noqa: comments were reported as incorrect
  • Fixes bug when some else: return were not reported as incorrect
  • Fixes bug when WPS507 sometimes were raising ValueError
  • Fixes bug when return None was not recognized as inconsistent

Misc

  • Adds styles/ directory with style presets for tools we use and recommend
  • Adds bellybutton to the list of other linters
  • Documents how to use nitpick to sync the configuration
  • Documents how to use flakehell to create baselines for legacy integrations
  • Improves tests for binary, octal, hex, and expanetional numbers
  • Adds new xenon CI check
  • Now handles exceptions in our own code, hope to never see them!
  • Now uses coverage checks in deepsource
  • Now @alias checks that all aliases are valid
  • Changes how presets are defined
  • Improves how DirectMagicAttributeAccessViolation is tested
  • Refactors a lot of tests to tests ast.Starred
  • Refactors a lot of tests to have less tests with the same logical coverage
  • We now use import-linter instead of layer-linter
  • Adds docs about CI integration
  • Now wheels are not universal
  • Updates docs about snake_case in Enum fields
  • Updates docs about WPS400 and incorrect line number