Version history¶
We follow Semantic Versions since the 0.1.0
release.
We used to have incremental versioning before 0.1.0
.
Semantic versioning in our case means:
Bugfixes do not bring new features, code that passes on
x.y.0
should pass onx.y.1
. With the only exception that bugfix can raise old violations in new places, if they were hidden by a buggy behaviour. But we do not add new checks.Minor releases do bring new features and configuration options. New violations can be added. Code that passes on
x.0.y
might not pass onx.1.y
release because of the new checks.Major releases inidicate significant milestones or serious breaking changes. There are no major releases right now: we are still at
0.x.y
version. But, in the future we might change the configuration names/logic, change the client facing API, change code conventions significantly, etc.
WIP¶
Features¶
wemake
output formatter now respectsNO_COLOR=1
option to disable text highlighting. See https://no-color.orgAdd
ImportObjectCollisionViolation
to detect the same objects imported under different aliases
Bugfixes¶
Fix
ForbiddenInlineIgnoreViolation
config parsing. #2590
0.18.0¶
Features¶
Breaking: drops
python3.7
support, because it has almost reached its EOLAdds
python3.11
supportBump
flake8
to version5.x
Bump
flake8-*
dependencies to newer versionsAdded
ChainedIsViolation
#2443Added
BuggySuperContextViolation
#2310
Bugfixes¶
Make
generic_visit()
check script properly handlewith
statements.Allow calling magic methods with the same name as the enclosing method #2381
Fix WrongEmptyLinesCountViolation false positive #2531
Fix OpenWithoutContextManagerViolation false positive #2577
Misc¶
Replaced
flakehell
mentions toflakeheaven
#2409
0.17.0¶
Features¶
Breaking: drops
python3.6
supportAdds support for pattern matching naming rules, same as other variables
Adds
--show-violation-links
option to show links to violation docsAdds
__init_subclass__
in the beginning of accepted methods order as per WPS338 #2411Adds
WrongEmptyLinesCountViolation
to check for too many lines in functions and methods definitions #2486
Bugfixes¶
Fixes
WPS226
false positives on|
use inSomeType | AnotherType
type hints syntaxNow
-1
is not reported to be an overused expressionAllow
__aiter__
to be async iteratorAdds violation method name to error message of
YieldMagicMethodViolation
Fixes direct docker image invocation #2492
Misc¶
Adds full violation codes to docs and
BaseViolation.full_code
#2409Fix documentation mismatch between default setting for
max-string-usages
and enforced rule #2456Domain name was changed from
wemake-python-stylegui.de
towemake-python-styleguide.rtfd.io
0.16.1¶
Bugfixes¶
Fixes crash on
'Literal["raise"]'
annotation #2341Fixes
WPS471
was not detected on complex assignment targets #2301Fixes
flake8-bandit
andbandit
version conflict #2368
0.16.0¶
Features¶
Supports new
flake8
version4.x
Now
InconsistentYieldViolation
andInconsistentReturnViolation
are raised whenyield
orreturn
is used withNone
where plain version should be used #2151Dot
'.'
and comma','
do not count against string literal overuse limit anymore #2209Added
RedundantEnumerateViolation
#1825Adds
RaiseFromItselfViolation
#2133Adds
ConsecutiveSlicesViolation
#2064Adds
KwargsUnpackingInClassDefinitionViolation
#1754DirectMagicAttributeAccessViolation
now only flags instances for which a known alternative exists #2268Forbids getting collection element of list by unpacking #1824
Now
WPS227
forbids returning tuples that are too long #1731
Bugfixes¶
Fixes that
InconsistentComprehensionViolation
was ignoring misalignedin
expressions #2075Fixes some common magic methods not being recognized as such #2281
Misc¶
Removes all
Raises:
from docstrings, they were unusedAdded example to
README.md
Added
why strict is good
Replaced all
python
withPython
inREADME.md
Improve Docs: Fixed all typos and grammatical errors in
CHANGELOG.md
Updated documentation with the recommended
isort
config. #1934Updates
typing_extensions
to4.x
0.15.3¶
Bugfixes¶
Fixes crash on
python3.10
Fixes
UselessReturningElseViolation
to not reportelse
withbreak
#1958Fixes
ReassigningVariableToItselfViolation
to not report onx = (x,)
#1807Fixes
ReassigningVariableToItselfViolation
to extract variables from unary operators #1874Fixes that
f'{some:,}'
was considered too complex #1921Fixes that
range(len(x))
was not allowed even outsidefor
loops #1883Fixes
UselessReturningElseViolation
to not reportelse
withbreak
#2187 (even if we haveexcept
in loop)Fixes fixture in
UselessReturningElseViolation
#2191
Misc¶
Adds documentation (and tests) for how to run project on Jupyter Notebooks
Updates
mypy
to0.902
and fixes type issues
0.15.2¶
Bugfixes¶
Fixes
BitwiseAndBooleanMixupViolation
work with PEP 604 union types #1884Fixes
CognitiveModuleComplexityViolation
to not trigger for a single-item modulesFixes that
ConstantConditionViolation
was not reported for aBoolOp
Functions and methods marked as
@overload
or@typing.overload
do not count in complexity rules
Misc¶
Updates GitHub Action’s base Python image version to
3.8.8
Features¶
Adds a math operations evaluator to improve and allow several violation checks.
0.15.1¶
Bugfixes¶
Fixes
dataclasses
import, it was failing onpython3.6
Fixes
InconsistentComprehensionViolation
work withasync
comprehensionsFixes nested comprehensions support for
InconsistentComprehensionViolation
Fixes multiple
if
support forInconsistentComprehensionViolation
Fixes that
NestedTernaryViolation
was not reported for a comprehensionFixes that
ConstantConditionViolation
was not reported for a comprehensionFixes that
ConstantConditionViolation
was triggering forwhile x := True:
Fixes that
UselessElseViolation
was not reported forfor
,while
, andtry
keywordsFixes false positive
InfiniteWhileLoopViolation
fortry
#1857Fixes that
InfiniteWhileLoopViolation
was not triggered on1
or other truthy nodes
Misc¶
Refactors how
tokenize
tests are executed, now we have an option to compile fixture code to make sure it is syntactically valid.
0.15.0 aka python3.9¶
Features¶
Adds
python3.9
supportForbids 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 writingpoint.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 asynchronousAllows 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 methodsForbids to use float zeros (
0.0
)Forbids
raise Exception
andraise BaseException
Forbids to use
%
with zero as the divisorForbids 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 necessaryForbids to use too complex
f
-stringsForbids to use too many
raise
statements inside a single functionForbids to compare with
float
andcomplex
valuesForbids 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 multiline 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
orset_attribute
Now
credits
,license
, andcopyright
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 literalsAllowed yield statements in call method
Allow to use
^
with1
Fixes false positives in WPS513 and WPS323
Fixes false positive WPS426 if
lambda
in loop uses only its argumentsFixes 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 expressionFixes that
-some
was counted as overused expressionFixes 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 visitorsUpdates
poetry
version to1.1
Updates
reviewdog
version to0.11.0
and addsaction-depup
0.14.0 aka The Walrus fighter¶
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 0.14 migration guide.
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%
operatorBreaking:
WPS441
is no longer triggered forexcept
blocks, it is now handled byF821
fromflake8
Breaking: removes
radon
, becausecognitive-complexity
andmccabe
is enoughBreaking: removes
flake8-logging-format
as a direct dependencyBreaking: removes
ImplicitTernaryViolation
orWPS332
, because it has too many false positives #1099Removes
flake8-coding
, all encoding strings, visitor and tests for oldWPS323
which is now reused for modulo formatting checksAdds
python3.8
supportChanges
styleguide.toml
andflake8.toml
scripts definitionExtracts new violation -
WPS450
fromWPS436
#1118Adds domain names options:
--allowed-domain-names
and--forbidden-domain-names
, that are used to create variable names’ blacklist #1106Forbids to use
\r
(carriage return) as line breaks in strings #1111Forbids to use
:=
operator, it now reusesWPS332
codeForbids to use positional only
/
argumentsForbids 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 methodsAdds
__call__
to list of methods that should be on top #1125Allows
_
to be now used as a defined variableRemoves
cognitive_complexity
dependency, now it is built in into our linterAdds 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 readAdds support for
NamedExpr
with in compare type violationForbids
float
andcomplex
compares
Bugfixes¶
Fixes how
i_control_code
behaves withWPS113
Fixes that cognitive complexity was ignoring
ast.Continue
,ast.Break
, andast.Raise
statementsFixes that cognitive complexity was ignoring
ast.AsyncFor
loopsFixes that annotation complexity was not reported for
async
functionsFixes that annotation complexity was not reported for lists
Fixes that annotation complexity was not reported for
*
and/
argsFixes 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 fieldsFixes negated conditions
WPS504
was not reported forif
expressionsFixes that
import dumps
was reported asWPS347
, now onlyfrom ... import dumps
is checkedFixes that
from some import a as std
was reported as a vague import withWPS347
despite having a meaningful aliasFixes that
WPS501
was reported for@contextmanager
definitionFixes
WPS226
to be thrown at nested string type annotationsFixes
WPS204
reported simplest nodes as overused like[]
andcall()
Fixes
WPS204
not reporting overusedf
stringsFixes
WPS204
reporting overused return type annotationsFixes
WPS204
reportingself.
attribute accessFixes
WPS331
reporting cases that do require some extra steps before returnFixes
WPS612
not reportingsuper()
calls without returnFixes
WPS404
not raising on wrong*
and/
defaultsFixes
WPS425
raising on.get
,getattr
,setattr
, and other builtin functions without keyword argumentsFixes
WPS221
reporting differently on differentpython
versionsFixes
WPS221
reporting nested variable annotationsFixes
WPS509
not reporting nested ternary in grandchildren ofif
Fixes
WPS509
not reporting nested ternary in ternaryFixes
WPS426
not reporting nestedlambda
in comprehensionsFixes several violations to reporting for
ast.Bytes
andast.FormattedStr
whereast.Str
was checkedFixes
WPS601
reporting shadowing for non-self
attributesFixes
WPS114
not to be so strictFixes
WPS122
not raising forfor
andasync for
definitionsFixes
WPS400
raising for# type: ignore[override]
commentsFixes
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 casesImproves old visitor tests with
:=
casesAdds
local-partial-types
to mypy configUses
abc
stdlib’s module to mark abstract base classes #1122Adds
python3.8
to the CIUpdates a lot of dependencies
0.13.4¶
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 testsAdds
flakehell
base configFixes
flakehell
docsFixes
MAX_NOQA_COMMENTS
and related violation docsFixes
OverusedExpressionViolation
andTooManyExpressionsViolation
docs
0.13.3¶
Misc¶
Updates
radon
versionUpdates
poetry
version to1.0
0.13.2¶
Bugfixes¶
Fixes that Github Action was failing for wrong status code
Fixes
NegatedConditionsViolation
false positive on absentelse
in combination withelif
Fixes
WPS528
false positive on augmented assignsFixes incorrect message for
WPS349
Fixes that
reviewdog
was not able to create more than30
comments per PR
Misc¶
pylint
docs fixedFixes docs about implicit
yield
violation
0.13.1¶
Bufixes¶
Fixes that
_
was marked as invalid byVagueImportViolation
Fixes that docs for
VagueImportViolation
were misleadingFixes invalid docs for
BracketBlankLineViolation
#1020Add 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 was 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` <https://github.com/Melevir/cognitive_complexity>`_
Adds docstrings linter ``darglint` <https://github.com/terrencepreilly/darglint>`_
Updates
pep8-naming
andflake8-comprehensions
WPS431
now allow customize whitelist vianested-classes-whitelist
settingForbids 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 expressionForbids to use
super()
with other methods and propertiesWPS350
enforces using augmented assign patternForbids unnecessary literals
WPS525
forbids comparisons wherein
is compared with single item containerForbids wrong annotations in assignment
Forbids using multiline
for
andwhile
statementsWPS113
now can be tweaked withI_CONTROL_CODE
settingAdds
WPS000
that indicates internal errorsForbids to use implicit
yield from
Forbids to start lines with
.
Enforces better
&
,|
,>>
,<<
,^
operators usageForbids incorrect exception order
Enforces tuples usage with frozenset constructor
Changes how
WPS444
works, now we use stricter logic forwhile
andassert
Forbids to use
yield from
with incorrect typesForbids to use consecutive
yield
expressionsEnforces to use
.items()
in loopsEnforces using
.get()
overkey in dict
checksForbids to use and declare
float
keys in arrays and dictionariesForbids to use
a[len(a) - 1]
because it is justa[-1]
Forbids too long call chains like
foo(a)(b)(c)(d)
Bugfixes¶
Fixes
ImplicitElifViolation
false positives on a specific edge casesFixes
--i-control-code
setting forBadMagicModuleFunctionViolation
Fixes compatibility with flake8
3.8.x
Fixes that
not not True
was not detected asWPS330
Fixes addition of
MisrefactoredAssignmentViolation
checkFixes
WrongMagicCommentViolation
not catching certain wrong commentsFixes
BadMagicModuleFunctionViolation
false positives on class-level methodsFixes
InconsistentReturnViolation
false positives on nested functionsFixes that
--i-dont-control-code
was not present in command line optionsFixes
BlockVariableVisitor
false positives on a propertiesFixes that
//
was not recognised as a math operationFixes false positive
BlockAndLocalOverlapViolation
on annotations without value assignFixes bug when
x and not x
was not detected as the similar conditions byWPS408
Fixed that
1.0
and0.1
were treated as magic numbers
Misc¶
Improves Github Action stability
Replace
scripts/tokens.py
andscripts/parse.py
with external toolsImproves violation code testing
Improves testing of
.. versionchanged
andprevious_codes
propertiesReference
isort
settings requirement for compliance withWSP318
in docstringImproves tests: we now ensure that each violation with previous codes also has corresponding versions changed in their documentation
0.12.5¶
Bugfixes¶
We now ignore
@overload
fromBlockAndLocalOverlapViolation
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
0.12.4¶
Bugfixes¶
Fixes bug with
nitpick
colors and new files APIUpdates
flake8-docstrings
0.12.3¶
Bugfixes¶
Fixes that formatting was failing sometimes when colours were not available
Fixes that
1 / number
was not allowedFixes that
%
operator was allowed for0
and1
0.12.2¶
Features¶
Adds
reveal_type
to the list of forbidden functionsWPS517
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
0.12.1¶
Features¶
Tweaks
nitpick
configuration
Bugfixes¶
Changes
radon
andpydocstyle
versions for better resolutionFixes
nitpick
urls
Misc¶
Improves
README.md
withflakehell
andnitpick
mentionsImproves docs all across the project
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 overlapping variables
Overused expressions and new complexity metrics
Features¶
Breaking: moves
ImplicitInConditionViolation
fromWPS336
toWPS514
Breaking: now
ExplicitStringConcatViolation
usesWPS336
Breaking: moves
YieldMagicMethodViolation
fromWPS435
toWPS611
Adds
xenon
as a dependency, it also checks for cyclomatic complexity, but uses more advanced algorithm with better resultsForbids to have modules with too many imported names configured by
--max-imported-names
option which is 50 by defaultForbids to raise
StopIteration
inside generatorsForbids 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 of1e+10
Enforces to use big letters for hex numbers:
0xAB
instead of0xab
Enforces to use
r'\n'
instead of'\\n'
Forbids to have unicode escape characters inside binary strings
Forbids to use
else if
instead ofelif
Forbids to have too long
try
bodies, basicallytry
bodies with more than one statementForbids 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 overJ
forcomplex
numbersForbids overused expressions
Forbids explicit
0
division, multiply, pow, addition, and subtractionFordids 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
assert
statements in a functionForbids to have explicit string contact:
'a' + some_data
, use.format()
Now
YieldInsideInitViolation
is namedYieldMagicMethodViolation
and it also checks different magic methods in a classForbids to use
assert False
and other false-constantsForbids to use
while False:
and other false-constantsForbids to use
open()
outside ofwith
Forbids to use
type()
for comparesForbids 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)
insteadForbids to use implicit
sum()
calls and replace them with loopsForbids to compare with the falsy constants like
if some == []:
Bugfixes¶
Bumps
flake8-eradicate
version and solvesattrs
incompatible versions issueBumps
flake8-dosctrings
version and solvedpydocstyle
issueFixes
TryExceptMultipleReturnPathViolation
not trackingelse
andfinally
returns at the same timeFixes how
TryExceptMultipleReturnPathViolation
works: now handlesbreak
andraise
statements as wellFixes
WrongLoopIterTypeViolation
not triggering for generator expressions and empty tuplesFixes
WrongLoopIterTypeViolation
not triggering for numbers (including negative), booleans,None
Fixes
WrongLoopIterTypeViolation
positionFixes
WrongLoopIterTypeViolation
not triggering for compehensionsFixes
WrongSlotsViolation
not triggering for comprehensions and incorrect__slots__
names and typesFixes
WrongSlotsViolation
not triggering for invalidpython
identifiers like__slots__ = ('123_slot',)
Fixes
WrongSlotsViolation
triggering for subscriptsFixes
NestedClassViolation
andNestedFunctionViolation
not reporting when placed deeply inside other nodesFixes when
WrongUnpackingViolation
was not raised forasync for
andasync with
nodesFixes when
WrongUnpackingViolation
was not raised for comprehensionsFixes that
x, y, z = x, z, y
was not recognized asReassigningVariableToItselfViolation
Fixes that
{1, True, 1.0}
was not recognised as a set with duplicatesFixes that
{(1, 2), (1, 2)}
was not recognised as a set with duplicatesFixes that
{*(1, 2), *(1, 2)}
was not recognised as a set with duplicatesFixes that
{1: 1, True: 1}
was not recognised as a dict with duplicatesFixes that
complex
numbers were always treated like magic, now1j
is allowedFixes that
0.0
was treated as a magic numberFixes that it was possible to use
_
in module bodyFixes
WrongBaseClassViolation
not triggering for nested nodes likeclass Test(call().length):
Fixes
ComplexDefaultValueViolation
not triggering for nested nodes likedef func(arg=call().attr)
Fixes
TooShortNameViolation
was not triggering for_x
andx_
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 incorrectFixes bug when some
else: return
were not reported as incorrectFixes bug when
WPS507
sometimes were raisingValueError
Fixes bug when
return None
was not recognized as inconsistent
Misc¶
Adds
styles/
directory with style presets for tools we use and recommendAdds
bellybutton
to the list of other lintersDocuments how to use
nitpick
to sync the configurationDocuments how to use
flakehell
to createbaseline
s for legacy integrationsImproves tests for binary, octal, hex, and exponentional numbers
Adds new
xenon
CI checkNow handles exceptions in our own code, hope to never see them!
Now uses
coverage
checks in deepsourceNow
@alias
checks that all aliases are validChanges how presets are defined
Improves how
DirectMagicAttributeAccessViolation
is testedRefactors 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 oflayer-linter
Adds docs about CI integration
Now wheels are not universal
Updates docs about
snake_case
inEnum
fieldsUpdates docs about
WPS400
and incorrect line number
0.11.1¶
Bugfixes¶
Now using
pygments
as a direct dependency
0.11.0 aka The New Violation Codes¶
We had a really big problem: all violations inside best_practices
was messed up together with no clear structure.
We had to fix it before it is too late. So, we broke existing error codes. And now we can promise not to do it ever again.
We also have this nice 0.11 migration guide for you to rename your violations with a script.
Features¶
Breaking: replaces
Z
error code toWPS
codeBreaking: creates new violation group
refactoring.py
Breaking: creates new violation group
oop.py
Breaking: moving a lot of violations from
best_practices
torefactoring
,oop
, andconsistency
Adds new
wemake
formatter (using it now by default)
Bugfixes¶
Fixes error message of
OverusedStringViolation
for empty stringsNow does not count string annotations as strings for
OverusedStringViolation
Fixes
InconsistentReturnVariableViolation
was raised twice
Misc¶
Adds migration guide to
0.11
Improves legacy guide
Adds
--show-source
to the default recommended configurationAdds better docs about auto-formatters
Adds
autopep8
to CI to make sure thatwps
is compatible with itEnsures that
--diff
mode works forflake8
Renames
Incorrect
toWrong
where possibleRenames
IncorrectlyNestedTernaryViolation
toNestedTernaryViolation
Renames
IncorectLoopIterTypeViolation
toWrongLoopIterTypeViolation
0.10.0 aka The Great Compare¶
This release is mostly targeted at writing better compares and conditions. We introduce a lot of new rules related to this topic improving: consistency, complexity, and general feel from your code.
In this release we have ported a lot of existing pylint
rules,
big kudos to the developers of this wonderful tool.
Features¶
Adds
flake8-executable
as a dependencyAdds
flake8-rst-docstrings
as a dependencyValidates options that are passed with
flake8
Forbids to use module level mutable constants
Forbids to over-use strings
Forbids to use
breakpoint
functionLimits yield tuple lengths
Forbids to have too many
await
statementsForbids to subclass lowercase
builtins
Forbids to have useless
lambda
sForbids to use
len(sized) > 0
andif len(sized)
style checksForbids to use repeatable conditions:
flag or flag
Forbids to write conditions like
not some > 1
Forbids to use heterogeneous compares like
x == x > 0
Forbids to use complex compare with several items (
>= 3
)Forbids to have class variables that are shadowed by instance variables
Forbids to use ternary expressions inside
if
conditionsForces to use ternary instead of
... and ... or ...
expressionForces to use
c < b < a
instead ofa > b and b > c
Forces to use
c < b < a
instead ofa > b > c
Forbids to use explicit
in []
andin ()
, use sets or variables insteadForces to write
isinstance(some, (A, B))
instead ofisinstance(some, A) or isinstance(some, B)
Forbids to use
isinstance(some (A,))
Forces to merge
a == b or a == c
intoa in {b, c}
and to mergea != b and a != c
intoa not in {b, c}
Bugfixes¶
Fixes incorrect line number for
Z331
Fixes that
Z311
was not raising for multiplenot in
casesFixes a bunch of bugs for rules working with
Assign
and notAnnAssign
Fixes that
continue
was not triggeringUselessReturningElseViolation
Misc¶
Renames
logics/
tologic/
since it is grammatically correctRenames
Redundant
toUseless
Renames
Comparison
toCompare
Renames
WrongConditionalViolation
toConstantConditionViolation
Renames
ComplexDefaultValuesViolation
toComplexDefaultValueViolation
Refactors
UselessOperatorsVisitor
Adds
compat/
package, getting ready forpython3.8
Adds
Makefile
A lot of minor dependency updates
0.9.1¶
Bugfixes¶
Fixes issue with
pydocstyle>=4
by glueing its version topydocstyle<4
0.9.0¶
This is mostly a supporting release with several new features and lots of bug fixes.
Features¶
Forbids to use magic module methods
__getattr__
and__dir__
Forbids to use multiline conditions
Forbids local variables that are only used in
return
statements
Bugfixes¶
Fixes module names for modules like
io.py
Fixes false positive
Z310
for numbers like0xE
Fixes false positive for compare ordering with
await
Fixes problem with missing
_allowed_left_nodes
Fixes problem false positive for
Z121
when using_
for unused var namesFixes false positive for negative number in default values
Fixes error text for
ComplexDefaultValueViolation
Fixes problem with false positive for
Z459
when a default value is anEllipsis
Misc¶
Adds
py.typed
file in case someone will import our code, now it will have typesAdds several missing
@final
decoratorsEnforces typing support
Refactors how
typing_extensions
package is usedAdds docs about
black
Adds big “Star” button
Multiple dependencies update
Better
exclude
rule forflake8
checkRemoved warnings from
pytest
0.8.1¶
Bugfixes¶
Fixes how
wps_context
is calculated, sosuper()
calls are now working
0.8.0¶
Features¶
Updates
flake8
to3.7+
Adds
flake8-annotations-complexity
as a dependency, forbids complex annotationsForbids to use redundant
+
,~
,not
, and-
operators before numbersForbids to use complex default values
Forbids to use anything rather than names in
for
loop vars definitionsForbids to use anything rather than names in
with
block vars definitionsForbids to use anything rather than names in comprehension vars definitions
Forbids to use direct magic attributes access
Forbids to use negated conditions
Forbids to use too many
# pragma: no cover
commentsForbids to use nested
try
blocks
Bugfixes¶
Fixes problems with empty lines after magic comments, see #492
Fixes error message for
del
keyword: it is now just'del'
not'delete'
Misc¶
Removes
flake8-per-file-ignores
plugin, sinceflake8
now handles itRemoves
flake8-type-annotations
plugin, sinceflake8
now handles itImproves docs for
WrongKeywordViolation
Improves docs for
EmptyLineAfterCodingViolation
Improves docs for
ProtectedAttributeViolation
Adds docs about
.pyi
files
0.7.1¶
Bugfixes¶
Allows
Generic[SomeType]
to be a valid superclassForces to use
flake8
version3.6
instead of3.7
Misc¶
Improves docs about using
# type: some
comment infor
loops
0.7.0¶
Features¶
Now raising a violation for every
bool
non-keyword argument and showing better error messageChanges how
max-arguments
are counted Nowself
,cls
, andmcs
count as real argumentsForbids to use
yield
inside comprehensionsForbids to have single line triple-quoted string assignments
Forbids to have same items in
set
literalsForbids to subclass
BaseException
Forbids to use simplifiable
if
expressions and nodesForbids to have incorrect nodes in
class
bodyForbids to have methods without any arguments
Forbids to have incorrect base classes nodes
Enforces consistent
__slots__
syntaxForbids to use names with trailing
_
without a reasonForbids to use
super()
with arguments or outside of methodsForbids to have too many
except
casesEnforces to have an empty line after
coding
commentForbids to use too many
# noqa
commentsForbids to use variables declared as unused
Forbids to use redundant
else
blocksForbids to use inconsistent
return
andyield
statementsForbids to use multiple
return
path intry
/expect
/finally
Forbids to use implicit string concatenation
Forbids to have useless
continue
nodes inside the loopsForbids to have useless nodes
Forbids to have useless
raise
statementsAdds
params
andparameters
to black-listed names
Bugfixes¶
Fixes a lot of rules that were ignoring
Bytes
node as constant typeFixes location of the
BooleanPositionalArgumentViolation
Fixes argument count issue with
async
functionsFixes
WrongConditionalVisitor
not detectingtuple
as constantsFixes
WrongConditionalVisitor
not detecting negative numbers as constantsFixes some magic number that were not detected based on their location
Fixes error when regular functions named as blacklisted magic methods were forbidden, now we check for methods only
Fixes error when strings like
U'some'
was not triggering unicode violationFixes error when string like
U'some'
was not triggering modifier violation
Misc¶
Adds
safety
and other dependency checks to the CI processImproves tests: now
tokenize
works differently inside testsImproves tests: now testing more brackets cases aka “magic coverage bug”
Improves docs: adds new badge about our code style
Refactoring: trying to use
astor
where possible to simplify the codebaseRefactoring: introduces some new
transformations
Refactoring: now we do not have any magical text casts for violations
Improves tests: changes how
flake8
is executed, now it is twice as fastImproves docs: now linting
conf.py
withflake8
Improves tests: now we check that ignored violation are raised with
noqa
Improves docs: we have added a special graph to show our architecture
Improves docs: we now have a clean page for
checker
without extra junkImproves docs: we now have a tutorial for creating new rules
Refactoring: moves
presets
package to the rootImproves tests: we now lint our layered architecture with
layer-lint
Version 0.6.3¶
Bugfixes¶
Fixes an issue-450 with
dict
s with just values and no keys
Version 0.6.2¶
Bugfixes¶
Fixes a crash with class attributes assignment
Version 0.6.1¶
Bugfixes¶
Fixes a conflict between our plugin and
pyflakes
Version 0.6.0¶
Features¶
Adds
flake8-per-file-ignore
plugin dependencyAdds default values to the
flake8 --help
outputAdds
do
as a restricted variable nameForbids multiple assignment targets for context managers
Forbids to use incorrect multi-line parameters
Forbids to use
bool
values as positional argumentsForbids to use extra indentation
Forbids to use inconsistent brackets
Forbids to use multi-line function type annotations
Forbids to use uppercase string modifiers
Forbids to use assign chains: now we only can use one assign per line
Forbids to use assign with unpacking for any nodes except
Name
Forbids to have duplicate
except
blocks
Bugfixes¶
Fixes tests failing on windows (@sobolevn hates windows!), but it still fails sometimes
Fixes bug when
@staticmethod
was treated as a module memberFixes bug when some nodes were not checked with
TooDeepNestingViolation
Fixes bug when it was possible to provide non-unique aliases
Fixes incorrect line number for incorrect parameter names
Fixes bug when names like
__some__value__
were not treated as underscoredFixes bug when assignment to anything rather than name was raising an error
Misc¶
Refactoring: now we fix
async
nodes offset in a special transformationImproves docs: specifies what
transformation
isImproves docs: making contributing section in the
README
more friendlyImproves build: changes how CI installs
poetry
0.5.1¶
Bugfixes¶
Fixes all possible errors that happen because of unset
parent
andfunction_type
properties
0.5.0¶
Features¶
Breaking: removes
--max-conditions
and--max-elifs
optionsBreaking: removes
--max-offset-blocks
Breaking: changes default
TooManyConditionsViolation
threshold from3
to4
Breaking: changes
TooManyBaseClassesViolation
code from225
to215
Forbids to use
lambda
inside loopsForbids to use
self
,cls
, andmcs
except for first arguments onlyForbids to use too many decorators
Forbids to have unreachable code
Forbids to have statements that have no effect
Forbids to have too long names for modules and variables
Forbids to have names with unicode for modules and variables
Add
variable
to the blacklisted namesNow
RedundantLoopElseViolation
also checkswhile
loops
Bugfixes¶
Fixes
TooManyConditionsViolation
to work with any conditions, not justif
sFixes
TooManyConditionsViolation
that did not count conditions correctlyFixes
TooManyForsInComprehensionViolation
to find all comprehension typesFixes
TooManyElifsViolation
to check module level conditionsFixes
TooManyBaseClassesViolation
docs locationFixes
WrongVariableNameViolation
not checkinglambda
argument namesFixes
OffsetVisitor
incorrectawait
handling
Misc¶
Refactoring: moves all complexity checks into
complexity/
folderRefactoring: improves how different keyword visitors are coupled
Improves docs: we have removed magic comments and code duplication
Improves docs: now
_pages/
is named justpages/
Improves docs: now all violations are sorted correctly
Improves tests: now testing different keywords separately
Improves tests: now all violations must be contained in
test_noqa.py
Improves tests: now we also run
compile()
on allast
examplesImproves tests: now we are sure about correct order of violations
0.4.0¶
Development was focused around better test coverage and providing a better API for tests. We also now covering more cases and testing violation texts.
Features¶
Breaking: removes duplicating module name rules, now we use the same rules for both variables and modules
Breaking: removes
--min-module-name-length
optionsBreaking: renames
--min-variable-name-length
into--min-name-length
Dependencies: updates
flake8
version to3.6
Dependencies: removes
pycodestyle
pinned versionRestrict unicode names
Bugfixes¶
Multiple fixes to error text formats to be more readable
Fixes
UNDERSCORED_NUMBER_PATTERN
to match names likecome_22_me
Fixes
UpperCaseAttributeViolation
not being displayed in the docsFixes consistency checks being duplicated in the docs
Fixes
UnderscoredNumberNameViolation
showing incorrect line numberFixes
ProtectedAttributeViolation
to respectsuper()
andmcs
Fixes
ProtectedAttributeViolation
to show correct textFixes
BadNumberSuffixViolation
to show correct textFixes
TooManyBaseClassesViolation
to show correct textFixes
TooManyElifsViolation
to show correct textFixes
TooDeepNestingViolation
to show correct textFixes
TooManyMethodsViolation
to show correct textFixes
ReassigningVariableToItselfViolation
to show correct textRenames
UnderscoredNumberNameViolation
toUnderscoredNumberNameViolation
Misc¶
Refactoring: removed duplicate logic inside
logics/filenames.py
Improves tests: now testing almost all violations inside
noqa.py
Improves tests: now testing violations text
Improves tests: now all common patters live in related
conftest.py
Improves docs: now all configuration options are listed in the violations
0.3.0 aka The Hacktoberfest Feast¶
This release was made possible by awesome people who contributed
to the project during #hactoberfest
. List of awesome people:
Features¶
Adds
flake8-print
as a dependencyAdds
typing-extensions
as a dependencyForbids to use
quit
andexit
functionsForbids the comparison of two literals
Forbids the incorrect order comparison, enforcing variable to come first
Forbids underscores before numbers in names
Forbids class level attributes whose name is not in
snake_case
Forbids comparison of the same variables
Forbids inconsistent octal, binary, and hex numbers
Forbids too many arguments in
lambda
functionsForbids extra
object
in parent classes listForbids
for
loops with unusedelse
Forbids variables self reassignment
Forbids
try
withfinally
withoutexcept
Forbids
if
statements with invalid conditionalsForbids opening parenthesis from following keyword without space in between them
Forbids the use of more than 2
for
loops within a comprehensionForbids variable names with more than one consecutive underscore
Restricts the maximum number of base classes aka mixins
Forbids importing protected names
Forbids using protected methods and attributes
Forbids
yield
inside__init__
method
Bugfixes¶
Fixes that
MultipleIfsInComprehensionViolation
was not enabledFixes flaky behaviour of
test_module_names
test packageFixed
TooManyMethodsViolation
not displaying line number in outputFixed
OffsetVisitor
due to python bug
Misc¶
Updates
poetry
versionRefactoring: some general changes, including better names and APIs
Improves docs: now we have
versionadded
for each violationImproves docs: now we explicitly state how some violations might be ignored
Improves tests: now we are testing options
Improves tests: now we have different
tests/
folder structureImproves tests: now we are testing presets
Improves tests: now we are using different logic inside
assert_errors
Improves tests: now testing magic numbers in more situations
Improves tests: now testing more situations with empty base classes
Improves tests: now testing presets, that they have all the existing visitors
Improves tests: now using stricter
noqa
checksImproves tests: now testing that any name is allowed when using a variable
Improves types: now all class attributes are marked as
ClassVar
Improves types: now we use
final
to indicate what should not be changedImproves types: now we do not have any ugly import hacks
0.2.0 aka Revenge of the Async¶
This release was made possible by awesome people who contributed
to the project during #hactoberfest
. List of awesome people:
Features¶
Now we are counting
async
function as a module memberWe now forbid to use
credits()
builtin functionWe now check
async for
andasync with
nesting levelWe now check
async for
andasync with
variable namesWe now count
async
methods as method for classes complexity checkWe now count
async
functions as functions for module complexity checkWe now check
async
functions names and argumentsWe now count
async
functions complexityWe now ignore
async
functions in jones complexity checkWe now check for nested
async
functionsWe now check for
async
functions with@staticmethod
decorator
Misc¶
Improves docs: add
usage.rst
Improves docs: adds naming convention to the
naming.py
Improves docs: multiple typos, bugs, and issues fixes
Improves tests: now we are testing
async
comprehensions
Version 0.1.0¶
Features¶
Breaking: changes violation codes, now they are grouped by meaning
Misc¶
Refactoring: changes how visitors are organized inside the package
Improves docs: now we have a glossary
Refactoring: refactoring terms that violate our glossary
Improves docs: now all error files contain fancy documentation and summary
Improves docs: now we have added API reference to the docs
Improves docs: adds new plugin development guide
Version 0.0.16¶
Features¶
Adds
flake8-logging-format
dependencyAdds
flake8-type-annotations
dependencyAdds
flake8-breaking-line
dependencyRemoves
flake8-super-call
dependencyAdds
PartialFloatViolation
Adds
MagicNumberViolation
Adds
WrongDocCommentViolation
Adds
MAGIC_NUMBERS_WHITELIST
constantChanges what variable names are blacklisted, adds
false
,true
, andno
Misc¶
Improves docs: now including docs for
--max-condition
optionImproves docs: adds some new
Zen of Python
referencesImproves tests: adds many new examples
Improves docs: now each error has its error message displayed in the docs
Improves docs: readme is now ready for the release
Improves docs: now error pages are split
Improves docs: now all
flake8
plugin dependencies are documented
Version 0.0.15¶
Features¶
Adds
MultipleIfsInComprehensionViolation
Adds
TooManyConditionsViolation
Adds
--max-conditions
option
Misc¶
Improves
CONTRIBUTING.md
Moves issues templates to
.github/
folderUpdate error thrown on
RedundantSubscriptViolation
Version 0.0.14¶
Features¶
Adds
WrongModuleNamePatternViolation
andWrongModuleNameUnderscoresViolation
Adds
TooManyImportsViolation
error and--max-imports
optionAdds
--i-control-code
option to ignoreInitModuleHasLogicViolation
Adds check for underscored numbers
Forbids
u''
stringsAdds
noqa
andtype
comments checks
Misc¶
Changes how many errors are generated for limits violations
Refactors how visitors are injected into the checker, now using presets
Creates new visitor type:
BaseTokenVisitor
for working withtokenize
Improves typing support
Adds
flake8-bandit
pluginAdds
flake8-eradicate
pluginAdds
flake8-print
plugin for developmentRemoves
delegate
concept from the codebase
Version 0.0.13 aka The Jones Complexity¶
Features¶
Adds
jones
complexity checkerAdds
--max-line-complexity
and--max-jones-score
options
Misc¶
Improves docs: adds detailed installation instructions
Removes
flake8-blind-except
plugin
Version 0.0.12¶
This is just a supporting release. There are no new features introduced.
We have changed the error codes for general checks.
Bugfixes¶
Fixes bug with nested imports missing ``parent` <https://github.com/wemake-services/wemake-python-styleguide/issues/120>`_
Fixes bug with incorrect ``pycodestyle` version <https://github.com/wemake-services/wemake-python-styleguide/issues/118>`_
Removes
BareRaiseViolation
as it does not fit the purpose of this package
Misc¶
Improves docs: now all errors are sorted by
code
Improves docs: now all errors have reasoning
Improves docs: some references are now clickable in web version
Improves docs: now docs include
CHANGELOG.md
Improves docs: now we have templates for
bug
andrule-request
Replaced
pytest-isort
withflake8-isort
Version 0.0.11¶
This is just a supporting release. There are no new features introduced.
Bugfixes¶
Fixes ``python3.7` support <https://github.com/wemake-services/wemake-python-styleguide/issues/93>`_
Fixes ``AttributeError: ‘ExceptHandler’ object has no attribute ‘depth’` <https://github.com/wemake-services/wemake-python-styleguide/issues/112>`_
Misc¶
Introduced the concept of regression testing, see
test/fixtures/regression
Removed
compat.py
Fixes some minor typos, problems, markup inside the docs
Adds some new configuration to
sphinx
Changes
sphinx
docs structure a little bit
Version 0.0.10 aka The Module Reaper¶
Features¶
Adds
WrongModuleNameViolation
,WrongModuleMagicNameViolation
, andTooShortModuleNameViolation
Adds
--min-module-name-length
config optionAdds a blacklist of module names
Adds
InitModuleHasLogicsViolation
Adds
EmptyModuleViolation
Adds a whitelist of magic module names
Bugfixes¶
Fixes
Option
class to have have incorrecttype
field, now using stringsFixes that
WrongStringTokenVisitor
was not activated
Misc¶
Improved typing support
Now each error has a link to the corresponding constant (if any)
Improved docs with links to the corresponding configuration flags
Version 0.0.9¶
This is just a supporting release. There are no new features introduced.
Bugfixes¶
Fixes
Attribute has no 'id'
errorFixes
missing 'typing_extension'
error
Misc¶
Errors are now tested
Complexity tests are refactored
Version 0.0.8 aka The Complex Complexity¶
Features¶
Now all dependencies are direct, they will be installed together with this package
Adds direct dependencies, now there’s no need to install any extra packages
Adds
TooDeepNestingViolation
andTooManyElifsViolation
checksAdds
--max-offset-blocks
and--max-elifs
optionsAdds
TooManyModuleMembersViolation
andTooManyMethodsViolation
checksAdds
--max-module-members
and--max-methods
optionsRestricts to use
f
strings
Bugfixes¶
Removes incorrect
generic_visit()
callsRemoves some unused
getattr()
callsRefactors how options are registered
Misc¶
Improved type support for options parsing
Version 0.0.7¶
Features¶
Added new magic methods to the black list
We now do not count
_
as a variable inTooManyLocals
checkWe now restrict to nest
lambda
sWe now allow to configure the minimal variable’s name length via
setup.cfg
Misc¶
Refactored how complexity checks are defined
Refactored how errors are defined
Now each check has strict
Raises:
policy which lists all possible errors that this check can find and raiseChanged how visitors are initialized in tests
Tests now cover nested classes’ explicit bases
Tests now cover nested classes and functions
noqa
comment
Version 0.0.6¶
Features¶
We now check import aliases to be different from the original name
Default complexity checks’ values have changed
Bugfixes¶
ReadTheDocs build is fixed by providing extra dependencies
Changed how local variables are counted
Misc¶
Improved typing support
Added new documentation sections
Version 0.0.5¶
Features¶
We now allow
generator_stop
to be a__future__
importWe now restrict dotted raw imports like:
import os.path
We now check import aliases as regular variable names
Misc¶
We have added a
CONTRIBUTING.md
file to help new contributors
Version 0.0.4¶
Features¶
We now check
class
es to match our styleguideClasses have their own error group
Z3
Using
@staticmethod
is now forbiddenDeclaring
object
as a base class is now requiredNow we check that
__del__
magic method is not usedVariable names
async
andawait
are forbiddenWe now forbid to use
__future__
importsWe now have a whitelist for
__future__
importsImports are now have its own subgroup
Z10
General rules now start from
Z11
Version 0.0.3¶
Features¶
We now use
Z
as the default code for our errorsWe have shuffled errors around, changing code and formats
Now all name errors share the same class
Adds
PrivateNameViolation
Now imports inside any structures rather than
Module
raises an errorAdds
file
andklass
as restricted namesNow
__import__
is just a bad function name, not a special caseNow version is defined in
poetry.toml
onlyWe now have configuration! And it covers all design errors
Bugfixes¶
Fixes issue with missing
parent
s :batman:Fixes issue with
_$NAME
patterns being ignored
Version 0.0.2¶
Features¶
Adds some new blacklisted variables’ names
Adds docs for each existing error code
Adds whitelisted names for nested functions:
decorator
andfactory
Adds new blacklisted module’s metadata variables
Removed
BAD_IMPORT_FUNCTIONS
variable, now just checking__import__
Testing¶
Add gen-tests that cover most of the issues
Removed almost all integration tests, saving just a few of them
Misc¶
Adds
poetry
as the main project toolAdds
shpinx
as a documentation tool
Version 0.0.1¶
Initial release