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.0should 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.ymight not pass onx.1.yrelease because of the new checks.Major releases indicate significant milestones or serious breaking changes. There are no major releases right now: we are still at
0.x.yversion. But, in the future we might change the configuration names/logic, change the client facing API, change code conventions significantly, etc.
1.6.2¶
Bugfixes¶
Fixes the false positive
WPS222for nested conditions, #3630Fixes the false positive
WPS529for dict subscripts in theelsebranch, #3501
1.6.1¶
Bugfixes¶
Fixes false positive
WPS366allowing the use of a single constant inor, #3610Fixes the false positive
WPS330when alternating unary operators, #3594
1.6.0¶
Features¶
Adds
python3.14official supportAllows walrus operator in
WPS332, #3505Forbids symmetric bitwise operations in
WPS345, #3593Adds
WPS366: forbid meaningless boolean operations, #3593Forbids complex f-string format specifiers in
WPS237, #3491
Bugfixes¶
Fixes false positive
WPS457forwhile Trueloop withawaitexpressions, #3753Fixes the false positive
WPS617by assigning a function that receives a lambda expression as a parameter, #3597Fixes false positive
WPS430for whitelisted nested functions, #3589Fixes false positive
WPS457forwhile Truenested intry/except, #3604
Removals¶
Breaking: Removes
WPS354, because it is inconsistent with async code, #3601
1.5.0¶
Features¶
Adds
WPS481: for statement not allowed in class and module scopes, #3520Allows
/string inWPS226, #3554Adds
WPS365: match statement can be simplified toif, #3520Allow re-exports in
WPS201, #3570
Bugfixes¶
Fixes
WPS226false-positive on fstring parts, #3548Fixes false positive
WPS412with docstring and imports in__init__.py, #3569
Misc¶
Improves docs: remove outdated AST online visualisation tool url
Returns
[tool.poetry]instead of[project]inpyproject.toml
1.4.0¶
Features¶
Allows
__init__.pyfiles that consist only of imports, #3486Adds
--max-conditionsoption, #3493Adds
--known-enum-basesoption to support custom enum-like base classes, #3513
Misc¶
Adds custom Sphinx directive
.. plugincodesfor violation rendering, #1318Adds violation classes filter for docs rendering, #3490
1.3.0¶
Features¶
Adds more names to
WPS110:spam,ham,tmp,temp,arr
Bugfixes¶
Fixes
WPS243to use number of statements infinallybody instead of a number of lines, #3458
1.2.0¶
Due to PEP-695, it’s now allowed
to use [] in decorators only for python3.12+.
@MyClassDecorator[T, V]
def some_function(): ...
Features¶
Adds
WPS243: forbids complexfinallybodies, #3458Adds
WPS478: forbids using non strict slice operations, #1011Adds
WPS479: forbids using multiline fstrings, #3405Adds
WPS480: forbids using comments inside formatted string, #3404
Bugfixes¶
Removes unnecessary
WPS604andWPS614rules from thenoqa.py, #3420Fixes
WPS115false-positive onStrEnum,IntEnum,IntFlagattributes, #3381Fixes
WPS432, now it ignores magic numbers inLiteral, #3397Fixes
WPS466for generic type specificationsMyClassDecorator[T], #3417Fixes
WPS212to ignore nested classes and functions when countingreturnstatements, #3413Improves
WPS349highlighting, #3437
1.1.0¶
Command line utility¶
This version introduces wps CLI tool.
wps explain <code> command can be used to access WPS
violation docs (same as on website) but without any internet access.
Features¶
Adds
WPS476: forbids to useawaitexpressions inforloops, #1600Adds
WPS477: forbidsTypeVarTupleafter aTypeVarwith a default, #3265
Bugfixes¶
Fixes
WPS115false-positive onEnumattributes, #3238Removes duplicated
WPS312, #3239Fixes
WPS432, now it shows literal num, #1402Fixes
WPS226, now it points to the first string literal occurrence, #3267Fixes
WPS605false-positive on@staticmethod, #3292Fixes
_SELFname not to triggerWPS117, #3310Fixes
WPS221being too strict with f-strings, #3350
1.0.0¶
Ruff¶
This release introduces the new main concept: ruff compatibility.
Now WPS is the only flake8 plugin that is installed.
Other things are done by ruff.
It is faster, it has autofixing, there are lots of rules.
Basically, this way WPS just gain lots
of new rule and plugins almost for free.
It is now stricter than ever! WPS now officially supports
ALL ruff existing rules. This means that there are no conflicts
between two linters.
To run WPS and ruff together, use:
ruff format && ruff check && flake8 --select=WPS .
You can copy our configuration from pyproject.toml (for ruff) and setup.cfg (for flake8).
Black¶
WPS can now also be used with black with default configuration.
However, we recommend using ruff format instead.
Speed¶
WPS got a lot faster! Because:
We removed a lot of
flake8pluginsWe removed a lot of rules covered by
ruff
Running 0.19.2 (previous version) on https://github.com/dry-python/returns
» time flake8 .
flake8 . 20.63s user 2.47s system 469% cpu 4.919 total
The same on 1.0.0:
» time flake8 .
flake8 . 8.56s user 0.54s system 898% cpu 1.013 total
Which is 2.4x times faster!
Integrations¶
We also significantly improved all the integrations!
WPS can now be used as first-class pre-commit hook with:
repos:
- repo: https://github.com/wemake-services/wemake-python-styleguide
rev: 1.0.0
hooks:
- id: wemake-python-styleguide
Our GitHub Action also got a lot of new options and fixes.
Removals¶
Breaking: Drops
python3.9supportBreaking: Drops
nitpicksupportBreaking: Drops
flake8-commas,flake8-isort,flake8-debugger,flake8-string-format,flake8-quotes,flake8-comprehensions,flake8-bugbear,flake8-docstrings,flake8-eradicate,flake8-bandit,flake8-broken-line,flake8-rst-docstrings,pep8-namingsupport, useruff formatandruff checkinsteadBreaking: Drops
darglintsupport, because it is unmaintainedBreaking: Removes
WPS113, because is covered bypylintlinterBreaking: Removes
WPS119, because is covered bypylintlinterBreaking: Removes
WPS125, because it is covered byrufflinterBreaking: Removes
WPS302, because it is covered byruffformatterBreaking: Removes
WPS304, because it is covered byruffformatterBreaking: Removes
WPS305, because it is covered byruffformatterBreaking: Removes
WPS306, because it is covered byruffformatterBreaking: Removes
WPS309, because it is covered byruffformatterBreaking: Removes
WPS310, because it is covered byruffformatterBreaking: Removes
WPS313, because it is covered byruffformatterBreaking: Removes
WPS315, because it is covered byruffformatterBreaking: Removes
WPS316, because it is covered byrufflinterBreaking: Removes
WPS317, because it is covered byruffformatterBreaking: Removes
WPS318, because it is covered byruffformatterBreaking: Removes
WPS319, because it is covered byruffformatterBreaking: Removes
WPS320, because it is covered byruffformatterBreaking: Removes
WPS323, because it is covered byruffformatterBreaking: Removes
WPS326, because it is covered byrufflinterBreaking: Removes
WPS329, because it is covered byrufflinterBreaking: Removes
WPS331, because it is covered byrufflinterBreaking: Removes
WPS333, because is covered bypylintlinterBreaking: Removes
WPS337, because it is covered byruffformatterBreaking: Removes
WPS340, because it is covered byruffformatterBreaking: Removes
WPS341, because it is covered byruffformatterBreaking: Removes
WPS343, because it is covered byruffformatterBreaking: Removes
WPS348, because it conflicts withruffformatterBreaking: Removes
WPS351, because it is covered byrufflinterBreaking: Removes
WPS352, because it is covered byruffformatterBreaking: Removes
WPS355, because it is covered byruffformatterBreaking: Removes
WPS360, because it is covered byruffformatterBreaking: Removes
WPS361, because it is covered byruffformatterBreaking: Removes
WPS415, because is covered byrufflinterBreaking: Removes
WPS417, because is covered byrufflinterBreaking: Removes
WPS419, because is covered byrufflinterBreaking: Removes
WPS423, because is covered byrufflinterBreaking: Removes
WPS424, because is covered byrufflinterBreaking: Removes
WPS425, because is covered byrufflinterBreaking: Removes
WPS428, because is covered byrufflinterBreaking: Removes
WPS433, because is covered bypylintlinterBreaking: Removes
WPS434, because is covered bypylintlinterBreaking: Removes
WPS436, because is covered bypylintlinterBreaking: Removes
WPS437, because is covered byrufflinterBreaking: Removes
WPS440, because it was buggy and is covered bymypy, #3209Breaking: Removes
WPS442, because it was buggy and is covered bymypy, #3209Breaking: Removes
WPS450, because is covered bypylintlinterBreaking: Removes
WPS452, because is covered byrufflinterBreaking: Removes
WPS454, because is covered byrufflinterBreaking: Removes
WPS456, because is covered byrufflinterBreaking: Removes
WPS465, because|is now heavily used by typingBreaking: Removes
WPS467, because is covered bypylintlinterBreaking: Removes
WPS502, because is covered byrufflinterBreaking: Removes
WPS503, because is covered byrufflinterBreaking: Removes
WPS507, because is covered bypylintlinterBreaking: Removes
WPS508, because is covered byrufflinterBreaking: Removes
WPS510, because is covered bypylintlinterBreaking: Removes
WPS514, because is covered bypylintlinterBreaking: Removes
WPS528, because is covered bypylintlinterBreaking: Removes
WPS525, because is covered byrufflinterBreaking: Removes
WPS526, because is covered byrufflinterBreaking: Removes
WPS521, because is covered byrufflinterBreaking: Removes
WPS609, because is covered bypylintlinterBreaking: Removes
--i-control-codesetting, if you want to disable some violations, just use# noqaor--ignorewith code that you want to exclude, there’s no need to create one more way of disabling some specific violations
Features¶
Adds official
python3.13supportAllows any compares in
assertstatements forWPS520, #3112Allows walrus operator (
:=) in comprehesions, #3121Allows
passincasebodies, #2642Allows subclassing builtins in
WPS600, when creating anEnum, #2506Allows using variables after blocks for
WPS441inassertstatements, #2543Does not count
self,cls, andmcsas arguments forWPS211complexity check anymore, #2394Allows underscores (
_) with exactly 3 digits after it inWPS303, #3120Allows class / instance attribute shadowing in
@dataclasses forWPS601, #1926Allows any number of instance attributes on
@dataclasses inWPS230, #2448Allows any number of function parameters in
@overloaddefinitions forWPS211, #1957Allows using multiline strings when placed on separate lines, #3056
Allows using
hasattrbuiltin function, #2228Disallows using
is notandnot inas negated conditions inWPS504, #2617Allows all branches in
if/elif/elseto be negated inWPS504, #2617Adds a new rule to forbid
lambdaassigns to special attributes, #1733Adds a new rule to check problematic function params, #1343
Adds a new rule to detect duplicate conditions in
ifs andelifs, #2241Adds a new rule to detect duplicate
casepatterns inmatch, #3206Adds a new rule to find too many
matchsubjects, #3201Adds a new rule to detect too many
casestatements, #3202Adds a new rule to find too complex
exceptwith too many exceptionsAdds a new rule to find too many
PEP695type paramsAdds a new rule to find useless ternary expressions, #1706
Adds a new rule to forbid
raise SystemExit, usesys.exitinstead, #1786Adds a new rule to forbid extra syntax in
match ...subjects, #3217Adds new
--allowed-module-metadataand--forbidden-module-metadataconfiguration options forWPS410, #3060Now
--allowed-domain-namesalso affectWPS11to allow custom short variable names, #2554Adds support to run
wemake-python-styleguideas apre-commithook, #2588GitHub Action can now use
cwd:parameter to specify where your configuration file is, #2474GitHub Action can now use
fail_workflow:parameter to not fail the workflow even if the check did find any issuesGitHub Action can now use
filter_mode:parameter to specify how ReviewDog will filter found violations, see https://github.com/reviewdog/reviewdog#filter-mode #2239
Bugfixes¶
Fixes
WPS217to allow simple calls infstrings, #3150Fixes
WPS217not to raise on emptyfstrings, becauseruff checkhandles that now for usFixes
OverusedStringViolationnot to include'...'stringRemoves
astorpackage in favour ofast.unparseFixes
WPS210to not count nested local variables in nested scopes #3108Fixes
IterableUnpackingViolationwith generic types andTypeVarTupleFixes
WPS469detecting incorrect names of raised exceptions, #3109Fixes unnormalized paths in formatter output
Fixes
WPS221to ignore PEP695’sTypeAliasfrom line complexity checksFixes
WPS474to only count import collisions in the same context, #2962Fixes
WPS612to count defaults in function definitions, #2478Fixes several bugs in
WPS322with multiline strings detectionFixes several violations not been detected in
case:statementsFixes
WPS314not detectingmatchstatementsFixes
match+casedoes not increase cognitive complexity
Misc¶
Integration with
ondividoc for legacy codebasesFixes a documentation error for the Formatter (Showing statistic) section
Source code is now formatted with
ruffRemoves deprecated
astnodes from code:ast.Num,ast.Bytes,ast.Str,ast.NamedConstant, etc
0.19.2¶
Bugfixes¶
Fixes
WrongEmptyLinesCountViolationcrash onCallable[..., ...]#2899
0.19.1¶
This release fixes how ... is used. For example, it is common to define
function stubs / protocols like this:
def some_function(): ...
Now, ... will be excluded from several rules.
Bugfixes¶
Fixes
TooDeepNestingViolationnot to trigger on...in functions and classesFixes
StatementHasNoEffectViolationnot to trigger on...in functions and classes, when it is the only node
0.19.0¶
This minor version will be the last release with all the flake8 plugins.
In the future this project will be migrated to be used together with ruff.
Features¶
Adds official
python3.12supportBreaking: drops
python3.8supportBreaking: Reconsider
objectrequired base class exception: sinceclass Klass[_Type]must not containobject, this rule is change to be the opposite:objectexplicit base class must not be used. You can useruffto change allobject-based types to the new style:ruff check --select=UP004 --fix .https://docs.astral.sh/ruff/rules/useless-object-inheritance/Breaking: allow positional-only parameters, since it is required by
mypywhen usingConcatenateAdds support for naming rules for PEP695 type params
Due to how
f-string are parsed inpython3.12several token-based violations are not reported anymore for them:UselessMultilineStringViolation,ImplicitRawStringViolation,WrongUnicodeEscapeViolation,RawStringNotNeededViolationwemakeoutput formatter now respectsNO_COLOR=1option to disable text highlighting. See https://no-color.orgAdds
ImportObjectCollisionViolationto detect the same objects imported under different aliasesAdds
reveal_localsto the list of forbidden functionsUpdates
flake8to7.x
Bugfixes¶
Fixes
ForbiddenInlineIgnoreViolationconfig parsing. #2590Fixes
WrongEmptyLinesCountViolationfor func definitions with ellipsis. #2847Fixes
WrongEmptyLinesCountViolationfor multiline implicit string concatenation. #2787Fixes
ObjectInBaseClassesListViolation,UnpythonicGetterSetterViolation,ImplicitInConditionViolation,RedundantSubscriptViolation,TooLongCompareViolationto include better error detailsFixes
TooDeepNestingViolationforTryStarandMatchstatementsFixes
TooLongTryBodyViolationandTooManyExceptCasesViolationto work forTryStarstatements as wellFixes
UselessNodeViolationto work withTryStarFixes
DuplicateExceptionViolationto work withTryStarFixes
TryExceptMultipleReturnPathViolationto work withTryStarFixes
IncorrectExceptOrderViolationto work withTryStarFixes that
MatchStarwas not checked in pattern matching name assignmentsFixes pattern matching support in
BlockAndLocalOverlapViolationandOuterScopeShadowingViolation
Misc¶
Updates multiple
flake8-*dependenciesFixes multiple typos in docs
0.18.0¶
Features¶
Breaking: drops
python3.7support, because it has almost reached its EOLAdds
python3.11supportBump
flake8to version5.xBump
flake8-*dependencies to newer versionsAdded
ChainedIsViolation#2443Added
BuggySuperContextViolation#2310
Bugfixes¶
Make
generic_visit()check script properly handlewithstatements.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
flakehellmentions toflakeheaven#2409
0.17.0¶
Features¶
Breaking: drops
python3.6supportAdds support for pattern matching naming rules, same as other variables
Adds
--show-violation-linksoption to show links to violation docsAdds
__init_subclass__in the beginning of accepted methods order as per WPS338 #2411Adds
WrongEmptyLinesCountViolationto check for too many lines in functions and methods definitions #2486
Bugfixes¶
Fixes
WPS226false positives on|use inSomeType | AnotherTypetype hints syntaxNow
-1is not reported to be an overused expressionAllow
__aiter__to be async iteratorAdds violation method name to error message of
YieldMagicMethodViolationFixes 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-usagesand enforced rule #2456Domain name was changed from
wemake-python-stylegui.detowemake-python-styleguide.rtfd.io
0.16.1¶
Bugfixes¶
Fixes crash on
'Literal["raise"]'annotation #2341Fixes
WPS471was not detected on complex assignment targets #2301Fixes
flake8-banditandbanditversion conflict #2368
0.16.0¶
Features¶
Supports new
flake8version4.xNow
InconsistentYieldViolationandInconsistentReturnViolationare raised whenyieldorreturnis used withNonewhere 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#1754DirectMagicAttributeAccessViolationnow only flags instances for which a known alternative exists #2268Forbids getting collection element of list by unpacking #1824
Now
WPS227forbids returning tuples that are too long #1731
Bugfixes¶
Fixes that
InconsistentComprehensionViolationwas ignoring misalignedinexpressions #2075Fixes some common magic methods not being recognized as such #2281
Misc¶
Removes all
Raises:from docstrings, they were unusedAdded example to
README.mdAdded
why strict is goodReplaced all
pythonwithPythoninREADME.mdImprove Docs: Fixed all typos and grammatical errors in
CHANGELOG.mdUpdated documentation with the recommended
isortconfig. #1934Updates
typing_extensionsto4.x
0.15.3¶
Bugfixes¶
Fixes crash on
python3.10Fixes
UselessReturningElseViolationto not reportelsewithbreak#1958Fixes
ReassigningVariableToItselfViolationto not report onx = (x,)#1807Fixes
ReassigningVariableToItselfViolationto extract variables from unary operators #1874Fixes that
f'{some:,}'was considered too complex #1921Fixes that
range(len(x))was not allowed even outsideforloops #1883Fixes
UselessReturningElseViolationto not reportelsewithbreak#2187 (even if we haveexceptin loop)Fixes fixture in
UselessReturningElseViolation#2191
Misc¶
Adds documentation (and tests) for how to run project on Jupyter Notebooks
Updates
mypyto0.902and fixes type issues
0.15.2¶
Bugfixes¶
Fixes
BitwiseAndBooleanMixupViolationwork with PEP 604 union types #1884Fixes
CognitiveModuleComplexityViolationto not trigger for a single-item modulesFixes that
ConstantConditionViolationwas not reported for aBoolOpFunctions and methods marked as
@overloador@typing.overloaddo 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
dataclassesimport, it was failing onpython3.6Fixes
InconsistentComprehensionViolationwork withasynccomprehensionsFixes nested comprehensions support for
InconsistentComprehensionViolationFixes multiple
ifsupport forInconsistentComprehensionViolationFixes that
NestedTernaryViolationwas not reported for a comprehensionFixes that
ConstantConditionViolationwas not reported for a comprehensionFixes that
ConstantConditionViolationwas triggering forwhile x := True:Fixes that
UselessElseViolationwas not reported forfor,while, andtrykeywordsFixes false positive
InfiniteWhileLoopViolationfortry#1857Fixes that
InfiniteWhileLoopViolationwas not triggered on1or other truthy nodes
Misc¶
Refactors how
tokenizetests 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.9supportForbids to use new-style decorators on
python3.9Changes 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 = 1will not trigger any violations. Previously, it would raise “too short name”.Forbids using non-trivial expressions as an argument to
exceptForbids 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 NoneAdd
__await__to the list of priority magic methodsForbids to use float zeros (
0.0)Forbids
raise Exceptionandraise BaseExceptionForbids 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
raisestatements inside a single functionForbids to compare with
floatandcomplexvaluesForbids 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_attributeorset_attributeNow
credits,license, andcopyrightbuiltins are free to shadow
Bugfixes¶
Fixes fails of annotation complexity on
Literal[""]Fixes how wrong variable names were checked case sensitive with
WPS110Fixes false positives DirectMagicAttributeAccessViolation with
__mro__,__subclasses__and__version__Make
WPS326work when there is comment between string literalsAllowed yield statements in call method
Allow to use
^with1Fixes false positives in WPS513 and WPS323
Fixes false positive WPS426 if
lambdain loop uses only its argumentsFixes false negative WPS421 with
pprint.pprintFixes 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
-somewas counted as overused expressionFixes several bugs with attribute names
Misc¶
Updates lots of dependencies
Fixed documentation for TooManyPublicAttributesViolation
Updated isort config
Introduce helper script to check for missing calls to
self.generic_visit(node)in AST visitorsUpdates
poetryversion to1.1Updates
reviewdogversion to0.11.0and 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 usingWPS452instead ofEXE001..EXE005Breaking: removes
flake8-print, now usingWPS421instead ofT001Breaking: removes
flake8-builtins, now usingWPS125instead ofA001..A005Breaking: removes
flake8-annotations-complexity, now usingWPS234instead ofTAE002Breaking: removes
flake8-pep3101, now usingWPS323instead ofS001, we also use a new logic for this violation: we check string defs for%patterns, and not for%operatorBreaking:
WPS441is no longer triggered forexceptblocks, it is now handled byF821fromflake8Breaking: removes
radon, becausecognitive-complexityandmccabeis enoughBreaking: removes
flake8-logging-formatas a direct dependencyBreaking: removes
ImplicitTernaryViolationorWPS332, because it has too many false positives #1099Removes
flake8-coding, all encoding strings, visitor and tests for oldWPS323which is now reused for modulo formatting checksAdds
python3.8supportChanges
styleguide.tomlandflake8.tomlscripts definitionExtracts new violation -
WPS450fromWPS436#1118Adds domain names options:
--allowed-domain-namesand--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 reusesWPS332codeForbids to use positional only
/argumentsForbids to have too many names imported from a single
from ... importForbids to use
continueandbreakinfinallyForbids 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_complexitydependency, now it is built in into our linterAdds baseline information for all complexity violation messages:
x > baselineChanges how cognitive complexity is calculated
Adds support for positional arguments in different checks
Adds
UnreadableNameViolationasWPS124because there are some character combination which is not easy to readAdds support for
NamedExprwith in compare type violationForbids
floatandcomplexcompares
Bugfixes¶
Fixes how
i_control_codebehaves withWPS113Fixes that cognitive complexity was ignoring
ast.Continue,ast.Break, andast.RaisestatementsFixes that cognitive complexity was ignoring
ast.AsyncForloopsFixes that annotation complexity was not reported for
asyncfunctionsFixes 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
TooManyPublicAttributesViolationwas counting duplicate fieldsFixes negated conditions
WPS504was not reported forifexpressionsFixes that
import dumpswas reported asWPS347, now onlyfrom ... import dumpsis checkedFixes that
from some import a as stdwas reported as a vague import withWPS347despite having a meaningful aliasFixes that
WPS501was reported for@contextmanagerdefinitionFixes
WPS226to be thrown at nested string type annotationsFixes
WPS204reported simplest nodes as overused like[]andcall()Fixes
WPS204not reporting overusedfstringsFixes
WPS204reporting overused return type annotationsFixes
WPS204reportingself.attribute accessFixes
WPS331reporting cases that do require some extra steps before returnFixes
WPS612not reportingsuper()calls without returnFixes
WPS404not raising on wrong*and/defaultsFixes
WPS425raising on.get,getattr,setattr, and other builtin functions without keyword argumentsFixes
WPS221reporting differently on differentpythonversionsFixes
WPS221reporting nested variable annotationsFixes
WPS509not reporting nested ternary in grandchildren ofifFixes
WPS509not reporting nested ternary in ternaryFixes
WPS426not reporting nestedlambdain comprehensionsFixes several violations to reporting for
ast.Bytesandast.FormattedStrwhereast.Strwas checkedFixes
WPS601reporting shadowing for non-selfattributesFixes
WPS114not to be so strictFixes
WPS122not raising forforandasync fordefinitionsFixes
WPS400raising for# type: ignore[override]commentsFixes
WPS115not raising for attributes inside other nodes
Misc¶
Changes how tests are executed
Changes how coverage is calculated, adds
coverage-conditional-pluginAdds how a violation can be deprecated
Improves old visitor tests with
/argument casesImproves old visitor tests with
:=casesAdds
local-partial-typesto mypy configUses
abcstdlib’s module to mark abstract base classes #1122Adds
python3.8to 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-pep3101Updates
flake8-builtinsUpdates
flake8-eradicateSeveral small refactoring sessions
Adds
hypothesis-based testsAdds
flakehellbase configFixes
flakehelldocsFixes
MAX_NOQA_COMMENTSand related violation docsFixes
OverusedExpressionViolationandTooManyExpressionsViolationdocs
0.13.3¶
Misc¶
Updates
radonversionUpdates
poetryversion to1.0
0.13.2¶
Bugfixes¶
Fixes that Github Action was failing for wrong status code
Fixes
NegatedConditionsViolationfalse positive on absentelsein combination withelifFixes
WPS528false positive on augmented assignsFixes incorrect message for
WPS349Fixes that
reviewdogwas not able to create more than30comments per PR
Misc¶
pylintdocs fixedFixes docs about implicit
yieldviolation
0.13.1¶
Bufixes¶
Fixes that
_was marked as invalid byVagueImportViolationFixes that docs for
VagueImportViolationwere 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_complexityAdds docstrings linter
darglintUpdates
pep8-namingandflake8-comprehensionsWPS431now allow customize whitelist vianested-classes-whitelistsettingForbids to have invalid strings in stared expressions like
**{'@': 1}Forbids to use implicit primitive values in a form of
lambda: 0Forbids 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-commentsForbid 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 propertiesWPS350enforces using augmented assign patternForbids unnecessary literals
WPS525forbids comparisons whereinis compared with single item containerForbids wrong annotations in assignment
Forbids using multiline
forandwhilestatementsWPS113now can be tweaked withI_CONTROL_CODEsettingAdds
WPS000that indicates internal errorsForbids to use implicit
yield fromForbids to start lines with
.Enforces better
&,|,>>,<<,^operators usageForbids incorrect exception order
Enforces tuples usage with frozenset constructor
Changes how
WPS444works, now we use stricter logic forwhileandassertForbids to use
yield fromwith incorrect typesForbids to use consecutive
yieldexpressionsEnforces to use
.items()in loopsEnforces using
.get()overkey in dictchecksForbids to use and declare
floatkeys 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
ImplicitElifViolationfalse positives on a specific edge casesFixes
--i-control-codesetting forBadMagicModuleFunctionViolationFixes compatibility with flake8
3.8.xFixes that
not not Truewas not detected asWPS330Fixes addition of
MisrefactoredAssignmentViolationcheckFixes
WrongMagicCommentViolationnot catching certain wrong commentsFixes
BadMagicModuleFunctionViolationfalse positives on class-level methodsFixes
InconsistentReturnViolationfalse positives on nested functionsFixes that
--i-dont-control-codewas not present in command line optionsFixes
BlockVariableVisitorfalse positives on a propertiesFixes that
//was not recognised as a math operationFixes false positive
BlockAndLocalOverlapViolationon annotations without value assignFixes bug when
x and not xwas not detected as the similar conditions byWPS408Fixed that
1.0and0.1were treated as magic numbers
Misc¶
Improves Github Action stability
Replace
scripts/tokens.pyandscripts/parse.pywith external toolsImproves violation code testing
Improves testing of
.. versionchangedandprevious_codespropertiesReference
isortsettings requirement for compliance withWPS318in 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
@overloadfromBlockAndLocalOverlapViolationNow 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
nitpickcolors and new files APIUpdates
flake8-docstrings
0.12.3¶
Bugfixes¶
Fixes that formatting was failing sometimes when colours were not available
Fixes that
1 / numberwas not allowedFixes that
%operator was allowed for0and1
0.12.2¶
Features¶
Adds
reveal_typeto the list of forbidden functionsWPS517now 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
nitpickconfiguration
Bugfixes¶
Changes
radonandpydocstyleversions for better resolutionFixes
nitpickurls
Misc¶
Improves
README.mdwithflakehellandnitpickmentionsImproves 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
ImplicitInConditionViolationfromWPS336toWPS514Breaking: now
ExplicitStringConcatViolationusesWPS336Breaking: moves
YieldMagicMethodViolationfromWPS435toWPS611Adds
xenonas 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-namesoption which is 50 by defaultForbids to raise
StopIterationinside 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
1e10instead of1e+10Enforces to use big letters for hex numbers:
0xABinstead of0xabEnforces to use
r'\n'instead of'\\n'Forbids to have unicode escape characters inside binary strings
Forbids to use
else ifinstead ofelifForbids to have too long
trybodies, basicallytrybodies with more than one statementForbids 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 overJforcomplexnumbersForbids overused expressions
Forbids explicit
0division, multiply, pow, addition, and subtractionFordids to pow, multiply, or divide by
1Forbids to use expressions like
x + -2, ory - -1, orz -= -1Forbids to multiply lists like
[0] * 2Forbids to use variable names like
__and_____Forbids to define unused variables explicitly:
_unused = 2Forbids to shadow outer scope variables with local ones
Forbids to have too many
assertstatements in a functionForbids to have explicit string contact:
'a' + some_data, use.format()Now
YieldInsideInitViolationis namedYieldMagicMethodViolationand it also checks different magic methods in a classForbids to use
assert Falseand other false-constantsForbids to use
while False:and other false-constantsForbids to use
open()outside ofwithForbids 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-eradicateversion and solvesattrsincompatible versions issueBumps
flake8-docstringsversion and solvedpydocstyleissueFixes
TryExceptMultipleReturnPathViolationnot trackingelseandfinallyreturns at the same timeFixes how
TryExceptMultipleReturnPathViolationworks: now handlesbreakandraisestatements as wellFixes
WrongLoopIterTypeViolationnot triggering for generator expressions and empty tuplesFixes
WrongLoopIterTypeViolationnot triggering for numbers (including negative), booleans,NoneFixes
WrongLoopIterTypeViolationpositionFixes
WrongLoopIterTypeViolationnot triggering for compehensionsFixes
WrongSlotsViolationnot triggering for comprehensions and incorrect__slots__names and typesFixes
WrongSlotsViolationnot triggering for invalidpythonidentifiers like__slots__ = ('123_slot',)Fixes
WrongSlotsViolationtriggering for subscriptsFixes
NestedClassViolationandNestedFunctionViolationnot reporting when placed deeply inside other nodesFixes when
WrongUnpackingViolationwas not raised forasync forandasync withnodesFixes when
WrongUnpackingViolationwas not raised for comprehensionsFixes that
x, y, z = x, z, ywas not recognized asReassigningVariableToItselfViolationFixes 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
complexnumbers were always treated like magic, now1jis allowedFixes that
0.0was treated as a magic numberFixes that it was possible to use
_in module bodyFixes
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 fromFixes bug when some correct
noqa:comments were reported as incorrectFixes bug when some
else: returnwere not reported as incorrectFixes bug when
WPS507sometimes were raisingValueErrorFixes bug when
return Nonewas not recognized as inconsistent
Misc¶
Adds
styles/directory with style presets for tools we use and recommendAdds
bellybuttonto the list of other lintersDocuments how to use
nitpickto sync the configurationDocuments how to use
flakehellto createbaselines for legacy integrationsImproves tests for binary, octal, hex, and exponential numbers
Adds new
xenonCI checkNow handles exceptions in our own code, hope to never see them!
Now uses
coveragechecks in deepsourceNow
@aliaschecks that all aliases are validChanges how presets are defined
Improves how
DirectMagicAttributeAccessViolationis testedRefactors a lot of tests to tests
ast.StarredRefactors a lot of tests to have less tests with the same logical coverage
We now use
import-linterinstead oflayer-linterAdds docs about CI integration
Now wheels are not universal
Updates docs about
snake_caseinEnumfieldsUpdates docs about
WPS400and incorrect line number
0.11.1¶
Bugfixes¶
Now using
pygmentsas 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
Zerror code toWPScodeBreaking: creates new violation group
refactoring.pyBreaking: creates new violation group
oop.pyBreaking: moving a lot of violations from
best_practicestorefactoring,oop, andconsistencyAdds new
wemakeformatter (using it now by default)
Bugfixes¶
Fixes error message of
OverusedStringViolationfor empty stringsNow does not count string annotations as strings for
OverusedStringViolationFixes
InconsistentReturnVariableViolationwas raised twice
Misc¶
Adds migration guide to
0.11Improves legacy guide
Adds
--show-sourceto the default recommended configurationAdds better docs about auto-formatters
Adds
autopep8to CI to make sure thatwpsis compatible with itEnsures that
--diffmode works forflake8Renames
IncorrecttoWrongwhere possibleRenames
IncorrectlyNestedTernaryViolationtoNestedTernaryViolationRenames
IncorrectLoopIterTypeViolationtoWrongLoopIterTypeViolation
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-executableas a dependencyAdds
flake8-rst-docstringsas a dependencyValidates options that are passed with
flake8Forbids to use module level mutable constants
Forbids to over-use strings
Forbids to use
breakpointfunctionLimits yield tuple lengths
Forbids to have too many
awaitstatementsForbids to subclass lowercase
builtinsForbids to have useless
lambdasForbids to use
len(sized) > 0andif len(sized)style checksForbids to use repeatable conditions:
flag or flagForbids to write conditions like
not some > 1Forbids to use heterogeneous compares like
x == x > 0Forbids 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
ifconditionsForces to use ternary instead of
... and ... or ...expressionForces to use
c < b < ainstead ofa > b and b > cForces to use
c < b < ainstead ofa > b > cForbids 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 == cintoa in {b, c}and to mergea != b and a != cintoa not in {b, c}
Bugfixes¶
Fixes incorrect line number for
Z331Fixes that
Z311was not raising for multiplenot incasesFixes a bunch of bugs for rules working with
Assignand notAnnAssignFixes that
continuewas not triggeringUselessReturningElseViolation
Misc¶
Renames
logics/tologic/since it is grammatically correctRenames
RedundanttoUselessRenames
ComparisontoCompareRenames
WrongConditionalViolationtoConstantConditionViolationRenames
ComplexDefaultValuesViolationtoComplexDefaultValueViolationRefactors
UselessOperatorsVisitorAdds
compat/package, getting ready forpython3.8Adds
MakefileA lot of minor dependency updates
0.9.1¶
Bugfixes¶
Fixes issue with
pydocstyle>=4by 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
returnstatements
Bugfixes¶
Fixes module names for modules like
io.pyFixes false positive
Z310for numbers like0xEFixes false positive for compare ordering with
awaitFixes problem with missing
_allowed_left_nodesFixes problem false positive for
Z121when using_for unused var namesFixes false positive for negative number in default values
Fixes error text for
ComplexDefaultValueViolationFixes problem with false positive for
Z459when a default value is anEllipsis
Misc¶
Adds
py.typedfile in case someone will import our code, now it will have typesAdds several missing
@finaldecoratorsEnforces typing support
Refactors how
typing_extensionspackage is usedAdds docs about
blackAdds big “Star” button
Multiple dependencies update
Better
excluderule forflake8checkRemoved warnings from
pytest
0.8.1¶
Bugfixes¶
Fixes how
wps_contextis calculated, sosuper()calls are now working
0.8.0¶
Features¶
Updates
flake8to3.7+Adds
flake8-annotations-complexityas 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
forloop vars definitionsForbids to use anything rather than names in
withblock 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 covercommentsForbids to use nested
tryblocks
Bugfixes¶
Fixes problems with empty lines after magic comments, see #492
Fixes error message for
delkeyword: it is now just'del'not'delete'
Misc¶
Removes
flake8-per-file-ignoresplugin, sinceflake8now handles itRemoves
flake8-type-annotationsplugin, sinceflake8now handles itImproves docs for
WrongKeywordViolationImproves docs for
EmptyLineAfterCodingViolationImproves docs for
ProtectedAttributeViolationAdds docs about
.pyifiles
0.7.1¶
Bugfixes¶
Allows
Generic[SomeType]to be a valid superclassForces to use
flake8version3.6instead of3.7
Misc¶
Improves docs about using
# type: somecomment inforloops
0.7.0¶
Features¶
Now raising a violation for every
boolnon-keyword argument and showing better error messageChanges how
max-argumentsare counted Nowself,cls, andmcscount as real argumentsForbids to use
yieldinside comprehensionsForbids to have single line triple-quoted string assignments
Forbids to have same items in
setliteralsForbids to subclass
BaseExceptionForbids to use simplifiable
ifexpressions and nodesForbids to have incorrect nodes in
classbodyForbids 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
exceptcasesEnforces to have an empty line after
codingcommentForbids to use too many
# noqacommentsForbids to use variables declared as unused
Forbids to use redundant
elseblocksForbids to use inconsistent
returnandyieldstatementsForbids to use multiple
returnpath intry/expect/finallyForbids to use implicit string concatenation
Forbids to have useless
continuenodes inside the loopsForbids to have useless nodes
Forbids to have useless
raisestatementsAdds
paramsandparametersto black-listed names
Bugfixes¶
Fixes a lot of rules that were ignoring
Bytesnode as constant typeFixes location of the
BooleanPositionalArgumentViolationFixes argument count issue with
asyncfunctionsFixes
WrongConditionalVisitornot detectingtupleas constantsFixes
WrongConditionalVisitornot 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
safetyand other dependency checks to the CI processImproves tests: now
tokenizeworks 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
astorwhere possible to simplify the codebaseRefactoring: introduces some new
transformationsRefactoring: now we do not have any magical text casts for violations
Improves tests: changes how
flake8is executed, now it is twice as fastImproves docs: now linting
conf.pywithflake8Improves tests: now we check that ignored violation are raised with
noqaImproves docs: we have added a special graph to show our architecture
Improves docs: we now have a clean page for
checkerwithout extra junkImproves docs: we now have a tutorial for creating new rules
Refactoring: moves
presetspackage to the rootImproves tests: we now lint our layered architecture with
layer-lint
Version 0.6.3¶
Bugfixes¶
Fixes an issue-450 with
dicts 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-ignoreplugin dependencyAdds default values to the
flake8 --helpoutputAdds
doas a restricted variable nameForbids multiple assignment targets for context managers
Forbids to use incorrect multi-line parameters
Forbids to use
boolvalues 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
NameForbids to have duplicate
exceptblocks
Bugfixes¶
Fixes tests failing on windows (@sobolevn hates windows!), but it still fails sometimes
Fixes bug when
@staticmethodwas treated as a module memberFixes bug when some nodes were not checked with
TooDeepNestingViolationFixes 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
asyncnodes offset in a special transformationImproves docs: specifies what
transformationisImproves docs: making contributing section in the
READMEmore friendlyImproves build: changes how CI installs
poetry
0.5.1¶
Bugfixes¶
Fixes all possible errors that happen because of unset
parentandfunction_typeproperties
0.5.0¶
Features¶
Breaking: removes
--max-conditionsand--max-elifsoptionsBreaking: removes
--max-offset-blocksBreaking: changes default
TooManyConditionsViolationthreshold from3to4Breaking: changes
TooManyBaseClassesViolationcode from225to215Forbids to use
lambdainside loopsForbids to use
self,cls, andmcsexcept 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
variableto the blacklisted namesNow
RedundantLoopElseViolationalso checkswhileloops
Bugfixes¶
Fixes
TooManyConditionsViolationto work with any conditions, not justifsFixes
TooManyConditionsViolationthat did not count conditions correctlyFixes
TooManyForsInComprehensionViolationto find all comprehension typesFixes
TooManyElifsViolationto check module level conditionsFixes
TooManyBaseClassesViolationdocs locationFixes
WrongVariableNameViolationnot checkinglambdaargument namesFixes
OffsetVisitorincorrectawaithandling
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.pyImproves tests: now we also run
compile()on allastexamplesImproves 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-lengthoptionsBreaking: renames
--min-variable-name-lengthinto--min-name-lengthDependencies: updates
flake8version to3.6Dependencies: removes
pycodestylepinned versionRestrict unicode names
Bugfixes¶
Multiple fixes to error text formats to be more readable
Fixes
UNDERSCORED_NUMBER_PATTERNto match names likecome_22_meFixes
UpperCaseAttributeViolationnot being displayed in the docsFixes consistency checks being duplicated in the docs
Fixes
UnderscoredNumberNameViolationshowing incorrect line numberFixes
ProtectedAttributeViolationto respectsuper()andmcsFixes
ProtectedAttributeViolationto show correct textFixes
BadNumberSuffixViolationto show correct textFixes
TooManyBaseClassesViolationto show correct textFixes
TooManyElifsViolationto show correct textFixes
TooDeepNestingViolationto show correct textFixes
TooManyMethodsViolationto show correct textFixes
ReassigningVariableToItselfViolationto show correct textRenames
UnderscoredNumberNameViolationtoUnderscoredNumberNameViolation
Misc¶
Refactoring: removed duplicate logic inside
logics/filenames.pyImproves tests: now testing almost all violations inside
noqa.pyImproves tests: now testing violations text
Improves tests: now all common patterns live in related
conftest.pyImproves 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-printas a dependencyAdds
typing-extensionsas a dependencyForbids to use
quitandexitfunctionsForbids 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_caseForbids comparison of the same variables
Forbids inconsistent octal, binary, and hex numbers
Forbids too many arguments in
lambdafunctionsForbids extra
objectin parent classes listForbids
forloops with unusedelseForbids variables self reassignment
Forbids
trywithfinallywithoutexceptForbids
ifstatements with invalid conditionalsForbids opening parenthesis from following keyword without space in between them
Forbids the use of more than 2
forloops 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
yieldinside__init__method
Bugfixes¶
Fixes that
MultipleIfsInComprehensionViolationwas not enabledFixes flaky behaviour of
test_module_namestest packageFixed
TooManyMethodsViolationnot displaying line number in outputFixed
OffsetVisitordue to python bug
Misc¶
Updates
poetryversionRefactoring: some general changes, including better names and APIs
Improves docs: now we have
versionaddedfor 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_errorsImproves 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
noqachecksImproves tests: now testing that any name is allowed when using a variable
Improves types: now all class attributes are marked as
ClassVarImproves types: now we use
finalto 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
asyncfunction as a module memberWe now forbid to use
credits()builtin functionWe now check
async forandasync withnesting levelWe now check
async forandasync withvariable namesWe now count
asyncmethods as method for classes complexity checkWe now count
asyncfunctions as functions for module complexity checkWe now check
asyncfunctions names and argumentsWe now count
asyncfunctions complexityWe now ignore
asyncfunctions in jones complexity checkWe now check for nested
asyncfunctionsWe now check for
asyncfunctions with@staticmethoddecorator
Misc¶
Improves docs: add
usage.rstImproves docs: adds naming convention to the
naming.pyImproves docs: multiple typos, bugs, and issues fixes
Improves tests: now we are testing
asynccomprehensions
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-formatdependencyAdds
flake8-type-annotationsdependencyAdds
flake8-breaking-linedependencyRemoves
flake8-super-calldependencyAdds
PartialFloatViolationAdds
MagicNumberViolationAdds
WrongDocCommentViolationAdds
MAGIC_NUMBERS_WHITELISTconstantChanges what variable names are blacklisted, adds
false,true, andno
Misc¶
Improves docs: now including docs for
--max-conditionoptionImproves docs: adds some new
Zen of PythonreferencesImproves 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
flake8plugin dependencies are documented
Version 0.0.15¶
Features¶
Adds
MultipleIfsInComprehensionViolationAdds
TooManyConditionsViolationAdds
--max-conditionsoption
Misc¶
Improves
CONTRIBUTING.mdMoves issues templates to
.github/folderUpdate error thrown on
RedundantSubscriptViolation
Version 0.0.14¶
Features¶
Adds
WrongModuleNamePatternViolationandWrongModuleNameUnderscoresViolationAdds
TooManyImportsViolationerror and--max-importsoptionAdds
--i-control-codeoption to ignoreInitModuleHasLogicViolationAdds check for underscored numbers
Forbids
u''stringsAdds
noqaandtypecomments 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:
BaseTokenVisitorfor working withtokenizeImproves typing support
Adds
flake8-banditpluginAdds
flake8-eradicatepluginAdds
flake8-printplugin for developmentRemoves
delegateconcept from the codebase
Version 0.0.13 aka The Jones Complexity¶
Features¶
Adds
jonescomplexity checkerAdds
--max-line-complexityand--max-jones-scoreoptions
Misc¶
Improves docs: adds detailed installation instructions
Removes
flake8-blind-exceptplugin
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
parentFixes bug with incorrect
pycodestyleversionRemoves
BareRaiseViolationas it does not fit the purpose of this package
Misc¶
Improves docs: now all errors are sorted by
codeImproves docs: now all errors have reasoning
Improves docs: some references are now clickable in web version
Improves docs: now docs include
CHANGELOG.mdImproves docs: now we have templates for
bugandrule-requestReplaced
pytest-isortwithflake8-isort
Version 0.0.11¶
This is just a supporting release. There are no new features introduced.
Bugfixes¶
Misc¶
Introduced the concept of regression testing, see
test/fixtures/regressionRemoved
compat.pyFixes some minor typos, problems, markup inside the docs
Adds some new configuration to
sphinxChanges
sphinxdocs structure a little bit
Version 0.0.10 aka The Module Reaper¶
Features¶
Adds
WrongModuleNameViolation,WrongModuleMagicNameViolation, andTooShortModuleNameViolationAdds
--min-module-name-lengthconfig optionAdds a blacklist of module names
Adds
InitModuleHasLogicsViolationAdds
EmptyModuleViolationAdds a whitelist of magic module names
Bugfixes¶
Fixes
Optionclass to have have incorrecttypefield, now using stringsFixes that
WrongStringTokenVisitorwas 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
TooDeepNestingViolationandTooManyElifsViolationchecksAdds
--max-offset-blocksand--max-elifsoptionsAdds
TooManyModuleMembersViolationandTooManyMethodsViolationchecksAdds
--max-module-membersand--max-methodsoptionsRestricts to use
fstrings
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 inTooManyLocalscheckWe now restrict to nest
lambdasWe 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
noqacomment
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_stopto be a__future__importWe now restrict dotted raw imports like:
import os.pathWe now check import aliases as regular variable names
Misc¶
We have added a
CONTRIBUTING.mdfile to help new contributors
Version 0.0.4¶
Features¶
We now check
classes to match our styleguideClasses have their own error group
Z3Using
@staticmethodis now forbiddenDeclaring
objectas a base class is now requiredNow we check that
__del__magic method is not usedVariable names
asyncandawaitare forbiddenWe now forbid to use
__future__importsWe now have a whitelist for
__future__importsImports are now have its own subgroup
Z10General rules now start from
Z11
Version 0.0.3¶
Features¶
We now use
Zas the default code for our errorsWe have shuffled errors around, changing code and formats
Now all name errors share the same class
Adds
PrivateNameViolationNow imports inside any structures rather than
Moduleraises an errorAdds
fileandklassas restricted namesNow
__import__is just a bad function name, not a special caseNow version is defined in
poetry.tomlonlyWe now have configuration! And it covers all design errors
Bugfixes¶
Fixes issue with missing
parents :batman:Fixes issue with
_$NAMEpatterns 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:
decoratorandfactoryAdds new blacklisted module’s metadata variables
Removed
BAD_IMPORT_FUNCTIONSvariable, 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
poetryas the main project toolAdds
shpinxas a documentation tool
Version 0.0.1¶
Initial release