Releases: wemake-services/wemake-python-styleguide
Releases · wemake-services/wemake-python-styleguide
Version 0.13.3
Misc
- Updates
radonversion - Updates
poetryversion to1.0
Version 0.13.2
Bugfixes
- Fixes that Github Action was failing for wrong status code
- Fixes
NegatedConditionsViolationfalse positive on absent
elsein combination withelif - Fixes
WPS528false positive on augmented assigns - Fixes incorrect message for
WPS349 - Fixes that
reviewdogwas not able to create more than30comments per PR
Misc
pylintdocs fixed- Fixes docs about implicit
yieldviolation
Version 0.13.1
Bufixes
- Fixes that
_was marked as invalid byVagueImportViolation - Fixes that docs for
VagueImportViolationwere 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
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-namingandflake8-comprehensions WPS431now allow customize whitelist vianested-classes-whitelistsetting- 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
OveruseOfNoqaCommentViolationconfigurable 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 WPS350enforces using augmented assign pattern- Forbids unnecessary literals
WPS525forbids comparisons whereinis compared with single item container- Forbids wrong annotations in assignment
- Forbids using multiline
forandwhilestatements WPS113now can be tweaked withI_CONTROL_CODEsetting- Adds
WPS000that 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
WPS444works, now we use stricter logic forwhileandassert - Forbids to use
yield fromwith incorrect types - Forbids to use consecutive
yieldexpressions - Enforces to use
.items()in loops - Enforces using
.get()overkey in dictchecks - Forbids to use and declare
floatkeys in arrays and dictionaries - Forbids to use
a[len(a) - 1]because it is justa[-1] - Forbids too long call chains like
foo(a)(b)(c)(d)
Bugfixes
- Fixes
ImplicitElifViolationfalse positives on a specific edge cases - Fixes
--i-control-codesetting forBadMagicModuleFunctionViolation - Fixes compatibility with flake8
3.8.x - Fixes that
not not Truewas not detected asWPS330 - Fixes addition of
MisrefactoredAssignmentViolationcheck - Fixes
WrongMagicCommentViolationnot catching certain wrong comments - Fixes
BadMagicModuleFunctionViolationfalse positives on class-level methods - Fixes
InconsistentReturnViolationfalse positives on nested functions - Fixes that
--i-dont-control-codewas not present in command line options - Fixes
BlockVariableVisitorfalse positives on a properties - Fixes that
//was not recognised as a math operation - Fixes false positive
BlockAndLocalOverlapViolationon annotations without value assign - Fixes bug when
x and not xwas not detected as the similar conditions byWPS408 - Fixed that
1.0and0.1were treated as magic numbers
Misc
- Improves Github Action stability
- Replace
scripts/tokens.pyandscripts/parse.pywith external tools - Improves violation code testing
- Improves testing of
.. versionchangedandprevious_codesproperties - Reference
isortsettings requirement for compliance withWSP318in docstring - Improves tests: we now ensure that each violation with previous codes also
has corresponding versions changed in their documentation
Version 0.12.5
Bugfixes
- We now ignore
@overloadfromBlockAndLocalOverlapViolation - 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
Bugfixes
- Fixes bug with
nitpickcolors and new files API - Updates
flake8-docstrings
Version 0.12.3
Bugfixes
- Fixes that formatting was failing sometimes when colours were not available
- Fixes that
1 / numberwas not allowed - Fixes that
%operator was allowed for0and1
Version 0.12.2
Features
- Adds
reveal_typeto the list of forbidden functions WPS517now 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
Bugfixes
- Changes
radonandpydocstyleversions for better resolution
Misc
- Improves
README.mdwithflakehellandnitpickmentions - Improves docs all accross the project
Version 0.12.0
In this release we had a little focus on:
- Primitives and constants and how to use them
- Strings and numbers and how to write them
- OOP features
- Blocks and code structure,
including variable scoping and overlaping variables - Overused expressions and new complexity metrics
Features
- Breaking: moves
ImplicitInConditionViolationfromWPS336toWPS514 - Breaking: now
ExplicitStringConcatViolationusesWPS336 - Breaking: moves
YieldMagicMethodViolationfromWPS435toWPS611 - Adds
xenonas 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-namesoption which is 50 by default - Forbids to raise
StopIterationinside 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
1e10instead of1e+10 - Enforces to use big letters for hex numbers:
0xABinstead of0xab - Enforces to use
r'\n'instead of'\\n' - Forbids to have unicode escape characters inside binary strings
- Forbids to use
else ifinstead ofelif - Forbids to have too long
trybodies,
basicallytrybodies with more than one statement - Forbids to overlap local and block variables
- Forbids to use block variables after the block definitions
- Changes how
WrongSlotsViolationworks, now(...) + valueis restricted
in favor of(..., *value) - Forbids to have explicit unhashable types in sets and dicts
- Forbids to define useless overwritten methods
- Enforces
jprefix overJforcomplexnumbers - Forbids overused expressions
- Forbids explicit
0division, multiply, pow, addition, and substraction - Fordids to pow, multiply, or divide by
1 - Forbids to use expressions like
x + -2, ory - -1, orz -= -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
assertstatements in a function - Forbids to have explicit string contact:
'a' + some_data, use.format() - Now
YieldInsideInitViolationis namedYieldMagicMethodViolation
and it also checks different magic methods in a class - Forbids to use
assert Falseand other false-constants - Forbids to use
while False:and other false-constants - Forbids to use
open()outside ofwith - 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)), useenumerate(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-eradicateversion
and solvesattrsincompatible versions issue - Bumps
flake8-dosctringsveresion
and solvedpydocstyleissue - Fixes
TryExceptMultipleReturnPathViolationnot trackingelseandfinally
returns at the same time - Fixes how
TryExceptMultipleReturnPathViolationworks:
now handlesbreakandraisestatements as well - Fixes
WrongLoopIterTypeViolationnot triggering
for generator expressions and empty tuples - Fixes
WrongLoopIterTypeViolationnot triggering
for numbers (including negative), booleans,None - Fixes
WrongLoopIterTypeViolationposition - Fixes
WrongLoopIterTypeViolationnot triggering for compehensions - Fixes
WrongSlotsViolationnot triggering
for comprehensions and incorrect__slots__names and types - Fixes
WrongSlotsViolationnot triggering
for invalidpythonidentifiers like__slots__ = ('123_slot',) - Fixes
WrongSlotsViolationtriggering for subscripts - Fixes
NestedClassViolationandNestedFunctionViolationnot reporting
when placed deeply inside other nodes - Fixes when
WrongUnpackingViolationwas not raised
forasync forandasync withnodes - Fixes when
WrongUnpackingViolationwas not raised for comprehensions - Fixes that
x, y, z = x, z, ywas not recognized
asReassigningVariableToItselfViolation - 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
complexnumbers were always treated like magic,
now1jis allowed - Fixes that
0.0was treated as a magic number - Fixes that it was possible to use
_in module body - Fixes
WrongBaseClassViolationnot triggering
for nested nodes likeclass Test(call().length): - Fixes
ComplexDefaultValueViolationnot triggering
for nested nodes likedef func(arg=call().attr) - Fixes
TooShortNameViolationwas not triggering for_xandx_ - 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: returnwere not reported as incorrect - Fixes bug when
WPS507sometimes were raisingValueError - Fixes bug when
return Nonewas not recognized as inconsistent
Misc
- Adds
styles/directory with style presets for tools we use and recommend - Adds
bellybuttonto the list of other linters - Documents how to use
nitpickto sync the configuration - Documents how to use
flakehellto createbaselines for legacy integrations - Improves tests for binary, octal, hex, and expanetional numbers
- Adds new
xenonCI check - Now handles exceptions in our own code, hope to never see them!
- Now uses
coveragechecks in deepsource - Now
@aliaschecks that all aliases are valid - Changes how presets are defined
- Improves how
DirectMagicAttributeAccessViolationis 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-linterinstead oflayer-linter - Adds docs about CI integration
- Now wheels are not universal
- Updates docs about
snake_caseinEnumfields - Updates docs about
WPS400and incorrect line number