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.
- Fixes the false positive
WPS222for nested conditions, #3630 - Fixes the false positive
WPS529for dict subscripts in theelsebranch, #3501
- Fixes false positive
WPS366allowing the use of a single constant inor, #3610 - Fixes the false positive
WPS330when alternating unary operators, #3594
- Adds
python3.14official support - Allows walrus operator in
WPS332, #3505 - Forbids symmetric bitwise operations in
WPS345, #3593 - Adds
WPS366: forbid meaningless boolean operations, #3593 - Forbids complex f-string format specifiers in
WPS237, #3491
- Fixes false positive
WPS457forwhile Trueloop withawaitexpressions, #3753 - Fixes the false positive
WPS617by assigning a function that receives a lambda expression as a parameter, #3597 - Fixes false positive
WPS430for whitelisted nested functions, #3589 - Fixes false positive
WPS457forwhile Truenested intry/except, #3604
- Breaking: Removes
WPS354, because it is inconsistent with async code, #3601
- Adds
WPS481: for statement not allowed in class and module scopes, #3520 - Allows
/string inWPS226, #3554 - Adds
WPS365: match statement can be simplified toif, #3520 - Allow re-exports in
WPS201, #3570
- Fixes
WPS226false-positive on fstring parts, #3548 - Fixes false positive
WPS412with docstring and imports in__init__.py, #3569
- Improves docs: remove outdated AST online visualisation tool url
- Returns
[tool.poetry]instead of[project]inpyproject.toml
- Allows
__init__.pyfiles that consist only of imports, #3486 - Adds
--max-conditionsoption, #3493 - Adds
--known-enum-basesoption to support custom enum-like base classes, #3513
- Adds custom Sphinx directive
.. plugincodesfor violation rendering, #1318 - Adds violation classes filter for docs rendering, #3490
- Adds more names to
WPS110:spam,ham,tmp,temp,arr
- Fixes
WPS243to use number of statements infinallybody instead of a number of lines, #3458
Due to PEP-695, it's now allowed
to use [] in decorators only for python3.12+.
@MyClassDecorator[T, V]
def some_function(): ...- Adds
WPS243: forbids complexfinallybodies, #3458 - Adds
WPS478: forbids using non strict slice operations, #1011 - Adds
WPS479: forbids using multiline fstrings, #3405 - Adds
WPS480: forbids using comments inside formatted string, #3404
- Removes unnecessary
WPS604andWPS614rules from thenoqa.py, #3420 - Fixes
WPS115false-positive onStrEnum,IntEnum,IntFlagattributes, #3381 - Fixes
WPS432, now it ignores magic numbers inLiteral, #3397 - Fixes
WPS466for generic type specificationsMyClassDecorator[T], #3417 - Fixes
WPS212to ignore nested classes and functions when countingreturnstatements, #3413 - Improves
WPS349highlighting, #3437
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.
- Adds
WPS476: forbids to useawaitexpressions inforloops, #1600 - Adds
WPS477: forbidsTypeVarTupleafter aTypeVarwith a default, #3265
- Fixes
WPS115false-positive onEnumattributes, #3238 - Removes duplicated
WPS312, #3239 - Fixes
WPS432, now it shows literal num, #1402 - Fixes
WPS226, now it points to the first string literal occurrence, #3267 - Fixes
WPS605false-positive on@staticmethod, #3292 - Fixes
_SELFname not to triggerWPS117, #3310 - Fixes
WPS221being too strict with f-strings, #3350
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).
WPS can now also be used with black with default configuration.
However, we recommend using ruff format instead.
WPS got a lot faster! Because:
- We removed a lot of
flake8plugins - We 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 totalThe 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!
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-styleguideOur GitHub Action also got a lot of new options and fixes.
- Breaking: Drops
python3.9support - Breaking: Drops
nitpicksupport - Breaking: 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 checkinstead - Breaking: Drops
darglintsupport, because it is unmaintained - Breaking: Removes
WPS113, because is covered bypylintlinter - Breaking: Removes
WPS119, because is covered bypylintlinter - Breaking: Removes
WPS125, because it is covered byrufflinter - Breaking: Removes
WPS302, because it is covered byruffformatter - Breaking: Removes
WPS304, because it is covered byruffformatter - Breaking: Removes
WPS305, because it is covered byruffformatter - Breaking: Removes
WPS306, because it is covered byruffformatter - Breaking: Removes
WPS309, because it is covered byruffformatter - Breaking: Removes
WPS310, because it is covered byruffformatter - Breaking: Removes
WPS313, because it is covered byruffformatter - Breaking: Removes
WPS315, because it is covered byruffformatter - Breaking: Removes
WPS316, because it is covered byrufflinter - Breaking: Removes
WPS317, because it is covered byruffformatter - Breaking: Removes
WPS318, because it is covered byruffformatter - Breaking: Removes
WPS319, because it is covered byruffformatter - Breaking: Removes
WPS320, because it is covered byruffformatter - Breaking: Removes
WPS323, because it is covered byruffformatter - Breaking: Removes
WPS326, because it is covered byrufflinter - Breaking: Removes
WPS329, because it is covered byrufflinter - Breaking: Removes
WPS331, because it is covered byrufflinter - Breaking: Removes
WPS333, because is covered bypylintlinter - Breaking: Removes
WPS337, because it is covered byruffformatter - Breaking: Removes
WPS340, because it is covered byruffformatter - Breaking: Removes
WPS341, because it is covered byruffformatter - Breaking: Removes
WPS343, because it is covered byruffformatter - Breaking: Removes
WPS348, because it conflicts withruffformatter - Breaking: Removes
WPS351, because it is covered byrufflinter - Breaking: Removes
WPS352, because it is covered byruffformatter - Breaking: Removes
WPS355, because it is covered byruffformatter - Breaking: Removes
WPS360, because it is covered byruffformatter - Breaking: Removes
WPS361, because it is covered byruffformatter - Breaking: Removes
WPS415, because is covered byrufflinter - Breaking: Removes
WPS417, because is covered byrufflinter - Breaking: Removes
WPS419, because is covered byrufflinter - Breaking: Removes
WPS423, because is covered byrufflinter - Breaking: Removes
WPS424, because is covered byrufflinter - Breaking: Removes
WPS425, because is covered byrufflinter - Breaking: Removes
WPS428, because is covered byrufflinter - Breaking: Removes
WPS433, because is covered bypylintlinter - Breaking: Removes
WPS434, because is covered bypylintlinter - Breaking: Removes
WPS436, because is covered bypylintlinter - Breaking: Removes
WPS437, because is covered byrufflinter - Breaking: Removes
WPS440, because it was buggy and is covered bymypy, #3209 - Breaking: Removes
WPS442, because it was buggy and is covered bymypy, #3209 - Breaking: Removes
WPS450, because is covered bypylintlinter - Breaking: Removes
WPS452, because is covered byrufflinter - Breaking: Removes
WPS454, because is covered byrufflinter - Breaking: Removes
WPS456, because is covered byrufflinter - Breaking: Removes
WPS465, because|is now heavily used by typing - Breaking: Removes
WPS467, because is covered bypylintlinter - Breaking: Removes
WPS502, because is covered byrufflinter - Breaking: Removes
WPS503, because is covered byrufflinter - Breaking: Removes
WPS507, because is covered bypylintlinter - Breaking: Removes
WPS508, because is covered byrufflinter - Breaking: Removes
WPS510, because is covered bypylintlinter - Breaking: Removes
WPS514, because is covered bypylintlinter - Breaking: Removes
WPS528, because is covered bypylintlinter - Breaking: Removes
WPS525, because is covered byrufflinter - Breaking: Removes
WPS526, because is covered byrufflinter - Breaking: Removes
WPS521, because is covered byrufflinter - Breaking: Removes
WPS609, because is covered bypylintlinter - Breaking: 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
- Adds official
python3.13support - Allows any compares in
assertstatements forWPS520, #3112 - Allows walrus operator (
:=) in comprehesions, #3121 - Allows
passincasebodies, #2642 - Allows subclassing builtins in
WPS600, when creating anEnum, #2506 - Allows using variables after blocks for
WPS441inassertstatements, #2543 - Does not count
self,cls, andmcsas arguments forWPS211complexity check anymore, #2394 - Allows underscores (
_) with exactly 3 digits after it inWPS303, #3120 - Allows class / instance attribute shadowing
in
@dataclasses forWPS601, #1926 - Allows any number of instance attributes on
@dataclasses inWPS230, #2448 - Allows any number of function parameters
in
@overloaddefinitions forWPS211, #1957 - Allows using multiline strings when placed on separate lines, #3056
- Allows using
hasattrbuiltin function, #2228 - Disallows using
is notandnot inas negated conditions inWPS504, #2617 - Allows all branches in
if/elif/elseto be negated inWPS504, #2617 - Adds a new rule to forbid
lambdaassigns to special attributes, #1733 - Adds a new rule to check problematic function params, #1343
- Adds a new rule to detect duplicate conditions in
ifs andelifs, #2241 - Adds a new rule to detect duplicate
casepatterns inmatch, #3206 - Adds a new rule to find too many
matchsubjects, #3201 - Adds a new rule to detect too many
casestatements, #3202 - Adds a new rule to find too complex
exceptwith too many exceptions - Adds a new rule to find too many
PEP695type params - Adds a new rule to find useless ternary expressions, #1706
- Adds a new rule to forbid
raise SystemExit, usesys.exitinstead, #1786 - Adds a new rule to forbid extra syntax in
match ...subjects, #3217 - Adds new
--allowed-module-metadataand--forbidden-module-metadataconfiguration options forWPS410, #3060 - Now
--allowed-domain-namesalso affectWPS11to allow custom short variable names, #2554 - Adds support to run
wemake-python-styleguideas apre-commithook, #2588 - GitHub Action can now use
cwd:parameter to specify where your configuration file is, #2474 - GitHub Action can now use
fail_workflow:parameter to not fail the workflow even if the check did find any issues - GitHub Action can now use
filter_mode:parameter to specify how ReviewDog will filter found violations, see https://github.com/reviewdog/reviewdog#filter-mode #2239
- Fixes
WPS217to allow simple calls infstrings, #3150 - Fixes
WPS217not to raise on emptyfstrings, becauseruff checkhandles that now for us - Fixes
OverusedStringViolationnot to include'...'string - Removes
astorpackage in favour ofast.unparse - Fixes
WPS210to not count nested local variables in nested scopes #3108 - Fixes
IterableUnpackingViolationwith generic types andTypeVarTuple - Fixes
WPS469detecting incorrect names of raised exceptions, #3109 - Fixes unnormalized paths in formatter output
- Fixes
WPS221to ignore PEP695'sTypeAliasfrom line complexity checks - Fixes
WPS474to only count import collisions in the same context, #2962 - Fixes
WPS612to count defaults in function definitions, #2478 - Fixes several bugs in
WPS322with multiline strings detection - Fixes several violations not been detected in
case:statements - Fixes
WPS314not detectingmatchstatements - Fixes
match+casedoes not increase cognitive complexity
- Integration with
ondividoc for legacy codebases - Fixes a documentation error for the Formatter (Showing statistic) section
- Source code is now formatted with
ruff - Removes deprecated
astnodes from code:ast.Num,ast.Bytes,ast.Str,ast.NamedConstant, etc
- Fixes
WrongEmptyLinesCountViolationcrash onCallable[..., ...]#2899
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.
- Fixes
TooDeepNestingViolationnot to trigger on...in functions and classes - Fixes
StatementHasNoEffectViolationnot to trigger on...in functions and classes, when it is the only node
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.
- Adds official
python3.12support - Breaking: drops
python3.8support - Breaking: 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 usingConcatenate - Adds 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,RawStringNotNeededViolation wemakeoutput formatter now respectsNO_COLOR=1option to disable text highlighting. See https://no-color.org- Adds
ImportObjectCollisionViolationto detect the same objects imported under different aliases - Adds
reveal_localsto the list of forbidden functions - Updates
flake8to7.x
- Fixes
ForbiddenInlineIgnoreViolationconfig parsing. #2590 - Fixes
WrongEmptyLinesCountViolationfor func definitions with ellipsis. #2847 - Fixes
WrongEmptyLinesCountViolationfor multiline implicit string concatenation. #2787 - Fixes
ObjectInBaseClassesListViolation,UnpythonicGetterSetterViolation,ImplicitInConditionViolation,RedundantSubscriptViolation,TooLongCompareViolationto include better error details - Fixes
TooDeepNestingViolationforTryStarandMatchstatements - Fixes
TooLongTryBodyViolationandTooManyExceptCasesViolationto work forTryStarstatements as well - Fixes
UselessNodeViolationto work withTryStar - Fixes
DuplicateExceptionViolationto work withTryStar - Fixes
TryExceptMultipleReturnPathViolationto work withTryStar - Fixes
IncorrectExceptOrderViolationto work withTryStar - Fixes that
MatchStarwas not checked in pattern matching name assignments - Fixes pattern matching support
in
BlockAndLocalOverlapViolationandOuterScopeShadowingViolation
- Updates multiple
flake8-*dependencies - Fixes multiple typos in docs
- Breaking: drops
python3.7support, because it has almost reached its EOL - Adds
python3.11support - Bump
flake8to version5.x - Bump
flake8-*dependencies to newer versions - Added
ChainedIsViolation#2443 - Added
BuggySuperContextViolation#2310
- 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
- Replaced
flakehellmentions toflakeheaven#2409
- Breaking: drops
python3.6support - Adds support for pattern matching naming rules, same as other variables
- Adds
--show-violation-linksoption to show links to violation docs - Adds
__init_subclass__in the beginning of accepted methods order as per WPS338 #2411 - Adds
WrongEmptyLinesCountViolationto check for too many lines in functions and methods definitions #2486
- Fixes
WPS226false positives on|use inSomeType | AnotherTypetype hints syntax - Now
-1is not reported to be an overused expression - Allow
__aiter__to be async iterator - Adds violation method name to error message of
YieldMagicMethodViolation - Fixes direct docker image invocation #2492
- Adds full violation codes to docs and
BaseViolation.full_code#2409 - Fix documentation mismatch between default setting
for
max-string-usagesand enforced rule #2456 - Domain name was changed from
wemake-python-stylegui.detowemake-python-styleguide.rtfd.io
- Fixes crash on
'Literal["raise"]'annotation #2341 - Fixes
WPS471was not detected on complex assignment targets #2301 - Fixes
flake8-banditandbanditversion conflict #2368
- Supports new
flake8version4.x - Now
InconsistentYieldViolationandInconsistentReturnViolationare raised whenyieldorreturnis used withNonewhere plain version should be used #2151 - Dot
'.'and comma','do not count against string literal overuse limit anymore #2209 - Added
RedundantEnumerateViolation#1825 - Adds
RaiseFromItselfViolation#2133 - Adds
ConsecutiveSlicesViolation#2064 - Adds
KwargsUnpackingInClassDefinitionViolation#1754 DirectMagicAttributeAccessViolationnow only flags instances for which a known alternative exists #2268- Forbids getting collection element of list by unpacking #1824
- Now
WPS227forbids returning tuples that are too long #1731
- Fixes that
InconsistentComprehensionViolationwas ignoring misalignedinexpressions #2075 - Fixes some common magic methods not being recognized as such #2281
- Removes all
Raises:from docstrings, they were unused - Added example to
README.md - Added
why strict is good - Replaced all
pythonwithPythoninREADME.md - Improve Docs: Fixed all typos and grammatical errors in
CHANGELOG.md - Updated documentation with the recommended
isortconfig. #1934 - Updates
typing_extensionsto4.x
- Fixes crash on
python3.10 - Fixes
UselessReturningElseViolationto not reportelsewithbreak#1958 - Fixes
ReassigningVariableToItselfViolationto not report onx = (x,)#1807 - Fixes
ReassigningVariableToItselfViolationto extract variables from unary operators #1874 - Fixes that
f'{some:,}'was considered too complex #1921 - Fixes that
range(len(x))was not allowed even outsideforloops #1883 - Fixes
UselessReturningElseViolationto not reportelsewithbreak#2187 (even if we haveexceptin loop) - Fixes fixture in
UselessReturningElseViolation#2191
- Adds documentation (and tests) for how to run project on Jupyter Notebooks
- Updates
mypyto0.902and fixes type issues
- Fixes
BitwiseAndBooleanMixupViolationwork with PEP 604 union types #1884 - Fixes
CognitiveModuleComplexityViolationto not trigger for a single-item modules - Fixes that
ConstantConditionViolationwas not reported for aBoolOp - Functions and methods marked as
@overloador@typing.overloaddo not count in complexity rules
- Updates GitHub Action's base Python image version to
3.8.8
- Adds a math operations evaluator to improve and allow several violation checks.
- Fixes
dataclassesimport, it was failing onpython3.6 - Fixes
InconsistentComprehensionViolationwork withasynccomprehensions - Fixes nested comprehensions support for
InconsistentComprehensionViolation - Fixes multiple
ifsupport forInconsistentComprehensionViolation - Fixes that
NestedTernaryViolationwas not reported for a comprehension - Fixes that
ConstantConditionViolationwas not reported for a comprehension - Fixes that
ConstantConditionViolationwas triggering forwhile x := True: - Fixes that
UselessElseViolationwas not reported forfor,while, andtrykeywords - Fixes false positive
InfiniteWhileLoopViolationfortry#1857 - Fixes that
InfiniteWhileLoopViolationwas not triggered on1or other truthy nodes
- Refactors how
tokenizetests are executed, now we have an option to compile fixture code to make sure it is syntactically valid.
- Adds
python3.9support - Forbids to use new-style decorators on
python3.9 - Changes how we treat own/foreign attributes,
since now we only check assigned attribute names for
self/cls/mcs, but not any other ones. So, now writingpoint.x = 1will not trigger any violations. Previously, it would raise "too short name". - Forbids using non-trivial expressions as an argument to
except - Forbids using too many variables in a tuple unpacking
- Forbids using
float("NaN"). - Forbids assigning to a slice
- Allow
__call__method to be asynchronous - Allows common strings not to be counted against string constant overuse limit
- Forbids to unpack iterable objects to lists #1259
- Forbids to use single
return None - Add
__await__to the list of priority magic methods - Forbids to use float zeros (
0.0) - Forbids
raise Exceptionandraise BaseException - Forbids to use
%with zero as the divisor - Forbids testing conditions to just return booleans when it is possible to simply return the condition itself
- Forbids to use unsafe infinite loops
- Forbids to use raw strings
r''when not necessary - Forbids to use too complex
f-strings - Forbids to use too many
raisestatements inside a single function - Forbids to compare with
floatandcomplexvalues - Forbids single element destruct
- Forbids to ignore some violations (configurable) on a line level
- Forbids single element unpacking
- Forbids to unpack lists with side-effects
- Forbids to use 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_attribute - Now
credits,license, andcopyrightbuiltins are free to shadow
- 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
WPS326work when there is comment between string literals - Allowed yield statements in call method
- Allow to use
^with1 - Fixes false positives in WPS513 and WPS323
- Fixes false positive WPS426 if
lambdain loop uses only its arguments - Fixes false negative WPS421 with
pprint.pprint - Fixes WPS441 triggering when reusing variable names in multiple loops
- Fixes false positive ImplicitEnumerateViolation on range with step #1742
- Allows to use
_to declare several unused variables, like:x, _, _ = coordinates() - Fixes variable reassignment in class context
- Fixes that
*'abc'was not counted as pointless star expression - Fixes that
-somewas counted as overused expression - Fixes several bugs with attribute names
- 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 visitors - Updates
poetryversion to1.1 - Updates
reviewdogversion to0.11.0and addsaction-depup
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.
- Breaking: removes
flake8-executable, now usingWPS452instead ofEXE001..EXE005 - Breaking: removes
flake8-print, now usingWPS421instead ofT001 - Breaking: removes
flake8-builtins, now usingWPS125instead ofA001..A005 - Breaking: removes
flake8-annotations-complexity, now usingWPS234instead ofTAE002 - Breaking: removes
flake8-pep3101, now usingWPS323instead ofS001, we also use a new logic for this violation: we check string defs for%patterns, and not for%operator - Breaking:
WPS441is no longer triggered forexceptblocks, it is now handled byF821fromflake8 - Breaking: removes
radon, becausecognitive-complexityandmccabeis enough - Breaking: removes
flake8-logging-formatas a direct dependency - Breaking: removes
ImplicitTernaryViolationorWPS332, because it has too many false positives #1099 - Removes
flake8-coding, all encoding strings, visitor and tests for oldWPS323which is now reused for modulo formatting checks - Adds
python3.8support - Changes
styleguide.tomlandflake8.tomlscripts definition - Extracts new violation -
WPS450fromWPS436#1118 - Adds domain names options:
--allowed-domain-namesand--forbidden-domain-names, that are used to create variable names' blacklist #1106 - Forbids to use
\r(carriage return) as line breaks in strings #1111 - Forbids to use
:=operator, it now reusesWPS332code - Forbids to use positional only
/arguments - Forbids to have too many names imported from a single
from ... import - Forbids to use
continueandbreakinfinally - Forbids to use
__reduce__and__reduce_ex__magic methods - Adds
__call__to list of methods that should be on top #1125 - Allows
_to be now used as a defined variable - Removes
cognitive_complexitydependency, now it is built in into our linter - Adds baseline information for all complexity violation messages:
x > baseline - Changes how cognitive complexity is calculated
- Adds support for positional arguments in different checks
- Adds
UnreadableNameViolationasWPS124because there are some character combination which is not easy to read - Adds support for
NamedExprwith in compare type violation - Forbids
floatandcomplexcompares
- Fixes how
i_control_codebehaves withWPS113 - Fixes that cognitive complexity was ignoring
ast.Continue,ast.Break, andast.Raisestatements - Fixes that cognitive complexity was ignoring
ast.AsyncForloops - Fixes that annotation complexity was not reported for
asyncfunctions - Fixes that annotation complexity was not reported for lists
- Fixes that annotation complexity was not reported for
*and/args - Fixes that annotation complexity was not tested for dot notation attributes
- Fixes that annotation complexity fails on string expressions
- Fixes bug when
TooManyPublicAttributesViolationwas counting duplicate fields - Fixes negated conditions
WPS504was not reported forifexpressions - Fixes that
import dumpswas reported asWPS347, now onlyfrom ... import dumpsis checked - Fixes that
from some import a as stdwas reported as a vague import withWPS347despite having a meaningful alias - Fixes that
WPS501was reported for@contextmanagerdefinition - Fixes
WPS226to be thrown at nested string type annotations - Fixes
WPS204reported simplest nodes as overused like[]andcall() - Fixes
WPS204not reporting overusedfstrings - Fixes
WPS204reporting overused return type annotations - Fixes
WPS204reportingself.attribute access - Fixes
WPS331reporting cases that do require some extra steps before return - Fixes
WPS612not reportingsuper()calls without return - Fixes
WPS404not raising on wrong*and/defaults - Fixes
WPS425raising on.get,getattr,setattr, and other builtin functions without keyword arguments - Fixes
WPS221reporting differently on differentpythonversions - Fixes
WPS221reporting nested variable annotations - Fixes
WPS509not reporting nested ternary in grandchildren ofif - Fixes
WPS509not reporting nested ternary in ternary - Fixes
WPS426not reporting nestedlambdain comprehensions - Fixes several violations to reporting for
ast.Bytesandast.FormattedStrwhereast.Strwas checked - Fixes
WPS601reporting shadowing for non-selfattributes - Fixes
WPS114not to be so strict - Fixes
WPS122not raising forforandasync fordefinitions - Fixes
WPS400raising for# type: ignore[override]comments - Fixes
WPS115not raising for attributes inside other nodes
- Changes how tests are executed
- Changes how coverage is calculated, adds
coverage-conditional-plugin - Adds how a violation can be deprecated
- Improves old visitor tests with
/argument cases - Improves old visitor tests with
:=cases - Adds
local-partial-typesto mypy config - Uses
abcstdlib's module to mark abstract base classes #1122 - Adds
python3.8to the CI - Updates a lot of dependencies
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.
- 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
- Updates
flake8-pep3101 - Updates
flake8-builtins - Updates
flake8-eradicate - Several small refactoring sessions
- Adds
hypothesis-based tests - Adds
flakehellbase config - Fixes
flakehelldocs - Fixes
MAX_NOQA_COMMENTSand related violation docs - Fixes
OverusedExpressionViolationandTooManyExpressionsViolationdocs
- Updates
radonversion - Updates
poetryversion to1.0
- Fixes that Github Action was failing for wrong status code
- Fixes
NegatedConditionsViolationfalse positive on absentelsein combination withelif - Fixes
WPS528false positive on augmented assigns - Fixes incorrect message for
WPS349 - Fixes that
reviewdogwas not able to create more than30comments per PR
pylintdocs fixed- Fixes docs about implicit
yieldviolation
- Fixes that
_was marked as invalid byVagueImportViolation - Fixes that docs for
VagueImportViolationwere misleading - Fixes invalid docs for
BracketBlankLineViolation#1020 - Add more complex example to
ParametersIndentationViolation#1021
- Now our GitHub Action can be used to leave PR review comments
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.
- Adds cognitive complexity metric, introduced by
cognitive_complexity - Adds docstrings linter
darglint - Updates
pep8-namingandflake8-comprehensions WPS431now allow customize whitelist vianested-classes-whitelistsetting- Forbids to have invalid strings in stared expressions like
**{'@': 1} - Forbids to use implicit primitive values in a form of
lambda: 0 - Forbids to use approximate math constants
- Forbids to redefine string constants
- Forbids use of vague import names (e.g.
from json import loads) - Makes
OveruseOfNoqaCommentViolationconfigurable via--max-noqa-comments - Forbid incorrectly swapped variables
- Forbids to use redundant subscripts (e.g.,
[0:7]or[3:None]) - Allows
super()as a valid overused expression - Forbids to use
super()with other methods and properties WPS350enforces using augmented assign pattern- Forbids unnecessary literals
WPS525forbids comparisons whereinis compared with single item container- Forbids wrong annotations in assignment
- Forbids using multiline
forandwhilestatements WPS113now can be tweaked withI_CONTROL_CODEsetting- Adds
WPS000that indicates internal errors - Forbids to use implicit
yield from - Forbids to start lines with
. - Enforces better
&,|,>>,<<,^operators usage - Forbids incorrect exception order
- Enforces tuples usage with frozenset constructor
- Changes how
WPS444works, now we use stricter logic forwhileandassert - Forbids to use
yield fromwith incorrect types - Forbids to use consecutive
yieldexpressions - Enforces to use
.items()in loops - Enforces using
.get()overkey in dictchecks - Forbids to use and declare
floatkeys in arrays and dictionaries - Forbids to use
a[len(a) - 1]because it is justa[-1] - Forbids too long call chains like
foo(a)(b)(c)(d)
- Fixes
ImplicitElifViolationfalse positives on a specific edge cases - Fixes
--i-control-codesetting forBadMagicModuleFunctionViolation - Fixes compatibility with flake8
3.8.x - Fixes that
not not Truewas not detected asWPS330 - Fixes addition of
MisrefactoredAssignmentViolationcheck - Fixes
WrongMagicCommentViolationnot catching certain wrong comments - Fixes
BadMagicModuleFunctionViolationfalse positives on class-level methods - Fixes
InconsistentReturnViolationfalse positives on nested functions - Fixes that
--i-dont-control-codewas not present in command line options - Fixes
BlockVariableVisitorfalse positives on a properties - Fixes that
//was not recognised as a math operation - Fixes false positive
BlockAndLocalOverlapViolationon annotations without value assign - Fixes bug when
x and not xwas not detected as the similar conditions byWPS408 - Fixed that
1.0and0.1were treated as magic numbers
- Improves Github Action stability
- Replace
scripts/tokens.pyandscripts/parse.pywith external tools - Improves violation code testing
- Improves testing of
.. versionchangedandprevious_codesproperties - Reference
isortsettings requirement for compliance withWPS318in docstring - Improves tests: we now ensure that each violation with previous codes also has corresponding versions changed in their documentation
- We now ignore
@overloadfromBlockAndLocalOverlapViolation - Now expressions that reuse block variables are not treated as violations,
example:
my_var = do_some(my_var)
- 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
- Fixes bug with
nitpickcolors and new files API - Updates
flake8-docstrings
- Fixes that formatting was failing sometimes when colours were not available
- Fixes that
1 / numberwas not allowed - Fixes that
%operator was allowed for0and1
- Adds
reveal_typeto the list of forbidden functions WPS517now allows to use non-string keys inside**{}, so this is allowed:Users.objects.get(**{User.USERNAME_FIELD: username})
- Fixes that
{**a, **b}was reported as duplicate hash items
- Tweaks
nitpickconfiguration
- Changes
radonandpydocstyleversions for better resolution - Fixes
nitpickurls
- Improves
README.mdwithflakehellandnitpickmentions - Improves docs all across the project
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
- Breaking: moves
ImplicitInConditionViolationfromWPS336toWPS514 - Breaking: now
ExplicitStringConcatViolationusesWPS336 - Breaking: moves
YieldMagicMethodViolationfromWPS435toWPS611 - Adds
xenonas a dependency, it also checks for cyclomatic complexity, but uses more advanced algorithm with better results - Forbids to have modules with too many imported names
configured by
--max-imported-namesoption which is 50 by default - Forbids to raise
StopIterationinside generators - Forbids to have incorrect method order inside classes
- Forbids to make some magic methods async
- Forbids to use meaningless zeros in float, binary, octal, hex, and expanentional numbers
- Enforces to use
1e10instead of1e+10 - Enforces to use big letters for hex numbers:
0xABinstead of0xab - Enforces to use
r'\n'instead of'\\n' - Forbids to have unicode escape characters inside binary strings
- Forbids to use
else ifinstead ofelif - Forbids to have too long
trybodies, basicallytrybodies with more than one statement - Forbids to overlap local and block variables
- Forbids to use block variables after the block definitions
- Changes how
WrongSlotsViolationworks, now(...) + valueis restricted in favor of(..., *value) - Forbids to have explicit unhashable types in sets and dicts
- Forbids to define useless overwritten methods
- Enforces
jprefix overJforcomplexnumbers - Forbids overused expressions
- Forbids explicit
0division, multiply, pow, addition, and subtraction - Fordids to pow, multiply, or divide by
1 - Forbids to use expressions like
x + -2, ory - -1, orz -= -1 - Forbids to multiply lists like
[0] * 2 - Forbids to use variable names like
__and_____ - Forbids to define unused variables explicitly:
_unused = 2 - Forbids to shadow outer scope variables with local ones
- Forbids to have too many
assertstatements in a function - Forbids to have explicit string contact:
'a' + some_data, use.format() - Now
YieldInsideInitViolationis namedYieldMagicMethodViolationand it also checks different magic methods in a class - Forbids to use
assert Falseand other false-constants - Forbids to use
while False:and other false-constants - Forbids to use
open()outside ofwith - Forbids to use
type()for compares - Forbids to have consecutive expressions with too deep access level
- Forbids to have too many public instance attributes
- Forbids to use pointless star operations:
print(*[]) - Forbids to use
range(len(some)), useenumerate(some)instead - Forbids to use implicit
sum()calls and replace them with loops - Forbids to compare with the falsy constants like
if some == []:
- Bumps
flake8-eradicateversion and solvesattrsincompatible versions issue - Bumps
flake8-docstringsversion and solvedpydocstyleissue - Fixes
TryExceptMultipleReturnPathViolationnot trackingelseandfinallyreturns at the same time - Fixes how
TryExceptMultipleReturnPathViolationworks: now handlesbreakandraisestatements as well - Fixes
WrongLoopIterTypeViolationnot triggering for generator expressions and empty tuples - Fixes
WrongLoopIterTypeViolationnot triggering for numbers (including negative), booleans,None - Fixes
WrongLoopIterTypeViolationposition - Fixes
WrongLoopIterTypeViolationnot triggering for compehensions - Fixes
WrongSlotsViolationnot triggering for comprehensions and incorrect__slots__names and types - Fixes
WrongSlotsViolationnot triggering for invalidpythonidentifiers like__slots__ = ('123_slot',) - Fixes
WrongSlotsViolationtriggering for subscripts - Fixes
NestedClassViolationandNestedFunctionViolationnot reporting when placed deeply inside other nodes - Fixes when
WrongUnpackingViolationwas not raised forasync forandasync withnodes - Fixes when
WrongUnpackingViolationwas not raised for comprehensions - Fixes that
x, y, z = x, z, ywas not recognized asReassigningVariableToItselfViolation - Fixes that
{1, True, 1.0}was not recognised as a set with duplicates - Fixes that
{(1, 2), (1, 2)}was not recognised as a set with duplicates - Fixes that
{*(1, 2), *(1, 2)}was not recognised as a set with duplicates - Fixes that
{1: 1, True: 1}was not recognised as a dict with duplicates - Fixes that
complexnumbers were always treated like magic, now1jis allowed - Fixes that
0.0was treated as a magic number - Fixes that it was possible to use
_in module body - Fixes
WrongBaseClassViolationnot triggering for nested nodes likeclass Test(call().length): - Fixes
ComplexDefaultValueViolationnot triggering for nested nodes likedef func(arg=call().attr) - Fixes
TooShortNameViolationwas not triggering for_xandx_ - Fixes that some magic method were allowed to be generators
- Fixes that some magic method were allowed to contain
yield from - Fixes bug when some correct
noqa:comments were reported as incorrect - Fixes bug when some
else: returnwere not reported as incorrect - Fixes bug when
WPS507sometimes were raisingValueError - Fixes bug when
return Nonewas not recognized as inconsistent
- Adds
styles/directory with style presets for tools we use and recommend - Adds
bellybuttonto the list of other linters - Documents how to use
nitpickto sync the configuration - Documents how to use
flakehellto createbaselines for legacy integrations - Improves tests for binary, octal, hex, and exponential numbers
- Adds new
xenonCI check - Now handles exceptions in our own code, hope to never see them!
- Now uses
coveragechecks in deepsource - Now
@aliaschecks that all aliases are valid - Changes how presets are defined
- Improves how
DirectMagicAttributeAccessViolationis tested - Refactors a lot of tests to tests
ast.Starred - Refactors a lot of tests to have less tests with the same logical coverage
- We now use
import-linterinstead oflayer-linter - Adds docs about CI integration
- Now wheels are not universal
- Updates docs about
snake_caseinEnumfields - Updates docs about
WPS400and incorrect line number
- Now using
pygmentsas a direct dependency
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.
- Breaking: replaces
Zerror code toWPScode - Breaking: creates new violation group
refactoring.py - Breaking: creates new violation group
oop.py - Breaking: moving a lot of violations
from
best_practicestorefactoring,oop, andconsistency - Adds new
wemakeformatter (using it now by default)
- Fixes error message of
OverusedStringViolationfor empty strings - Now does not count string annotations as strings for
OverusedStringViolation - Fixes
InconsistentReturnVariableViolationwas raised twice
- Adds migration guide to
0.11 - Improves legacy guide
- Adds
--show-sourceto the default recommended configuration - Adds better docs about auto-formatters
- Adds
autopep8to CI to make sure thatwpsis compatible with it - Ensures that
--diffmode works forflake8 - Renames
IncorrecttoWrongwhere possible - Renames
IncorrectlyNestedTernaryViolationtoNestedTernaryViolation - Renames
IncorrectLoopIterTypeViolationtoWrongLoopIterTypeViolation
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.
- Adds
flake8-executableas a dependency - Adds
flake8-rst-docstringsas a dependency - Validates options that are passed with
flake8 - Forbids to use module level mutable constants
- Forbids to over-use strings
- Forbids to use
breakpointfunction - Limits yield tuple lengths
- Forbids to have too many
awaitstatements - Forbids to subclass lowercase
builtins - Forbids to have useless
lambdas - Forbids to use
len(sized) > 0andif len(sized)style checks - Forbids 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
ifconditions - Forces to use ternary instead of
... and ... or ...expression - Forces to use
c < b < ainstead ofa > b and b > c - Forces to use
c < b < ainstead ofa > b > c - Forbids to use explicit
in []andin (), use sets or variables instead - Forces 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}
- Fixes incorrect line number for
Z331 - Fixes that
Z311was not raising for multiplenot incases - Fixes a bunch of bugs for rules working with
Assignand notAnnAssign - Fixes that
continuewas not triggeringUselessReturningElseViolation
- Renames
logics/tologic/since it is grammatically correct - Renames
RedundanttoUseless - Renames
ComparisontoCompare - Renames
WrongConditionalViolationtoConstantConditionViolation - Renames
ComplexDefaultValuesViolationtoComplexDefaultValueViolation - Refactors
UselessOperatorsVisitor - Adds
compat/package, getting ready forpython3.8 - Adds
Makefile - A lot of minor dependency updates
- Fixes issue with
pydocstyle>=4by glueing its version topydocstyle<4
This is mostly a supporting release with several new features and lots of bug fixes.
- Forbids to use magic module methods
__getattr__and__dir__ - Forbids to use multiline conditions
- Forbids local variables that are only used in
returnstatements
- Fixes module names for modules like
io.py - Fixes false positive
Z310for numbers like0xE - Fixes false positive for compare ordering with
await - Fixes problem with missing
_allowed_left_nodes - Fixes problem false positive for
Z121when using_for unused var names - Fixes false positive for negative number in default values
- Fixes error text for
ComplexDefaultValueViolation - Fixes problem with false positive for
Z459when a default value is anEllipsis
- Adds
py.typedfile in case someone will import our code, now it will have types - Adds several missing
@finaldecorators - Enforces typing support
- Refactors how
typing_extensionspackage is used - Adds docs about
black - Adds big "Star" button
- Multiple dependencies update
- Better
excluderule forflake8check - Removed warnings from
pytest
- Fixes how
wps_contextis calculated, sosuper()calls are now working
- Updates
flake8to3.7+ - Adds
flake8-annotations-complexityas a dependency, forbids complex annotations - Forbids to use redundant
+,~,not, and-operators before numbers - Forbids to use complex default values
- Forbids to use anything rather than names in
forloop vars definitions - Forbids to use anything rather than names in
withblock vars definitions - Forbids 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 covercomments - Forbids to use nested
tryblocks
- Fixes problems with empty lines after magic comments, see #492
- Fixes error message for
delkeyword: it is now just'del'not'delete'
- Removes
flake8-per-file-ignoresplugin, sinceflake8now handles it - Removes
flake8-type-annotationsplugin, sinceflake8now handles it - Improves docs for
WrongKeywordViolation - Improves docs for
EmptyLineAfterCodingViolation - Improves docs for
ProtectedAttributeViolation - Adds docs about
.pyifiles
- Allows
Generic[SomeType]to be a valid superclass - Forces to use
flake8version3.6instead of3.7
- Improves docs about using
# type: somecomment inforloops
- Now raising a violation for every
boolnon-keyword argument and showing better error message - Changes how
max-argumentsare counted Nowself,cls, andmcscount as real arguments - Forbids to use
yieldinside comprehensions - Forbids to have single line triple-quoted string assignments
- Forbids to have same items in
setliterals - Forbids to subclass
BaseException - Forbids to use simplifiable
ifexpressions and nodes - Forbids to have incorrect nodes in
classbody - Forbids to have methods without any arguments
- Forbids to have incorrect base classes nodes
- Enforces consistent
__slots__syntax - Forbids to use names with trailing
_without a reason - Forbids to use
super()with arguments or outside of methods - Forbids to have too many
exceptcases - Enforces to have an empty line after
codingcomment - Forbids to use too many
# noqacomments - Forbids to use variables declared as unused
- Forbids to use redundant
elseblocks - Forbids to use inconsistent
returnandyieldstatements - Forbids to use multiple
returnpath intry/expect/finally - Forbids to use implicit string concatenation
- Forbids to have useless
continuenodes inside the loops - Forbids to have useless nodes
- Forbids to have useless
raisestatements - Adds
paramsandparametersto black-listed names
- Fixes a lot of rules that were ignoring
Bytesnode as constant type - Fixes location of the
BooleanPositionalArgumentViolation - Fixes argument count issue with
asyncfunctions - Fixes
WrongConditionalVisitornot detectingtupleas constants - Fixes
WrongConditionalVisitornot detecting negative numbers as constants - Fixes 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 violation - Fixes error when string like
U'some'was not triggering modifier violation
- Adds
safetyand other dependency checks to the CI process - Improves tests: now
tokenizeworks differently inside tests - Improves 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 codebase - Refactoring: introduces some new
transformations - Refactoring: now we do not have any magical text casts for violations
- Improves tests: changes how
flake8is executed, now it is twice as fast - Improves docs: now linting
conf.pywithflake8 - 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
checkerwithout extra junk - Improves docs: we now have a tutorial for creating new rules
- Refactoring: moves
presetspackage to the root - Improves tests: we now lint our layered architecture with
layer-lint
- Fixes an issue-450 with
dicts with just values and no keys
- Fixes a crash with class attributes assignment
- Fixes a conflict between our plugin and
pyflakes
- Adds
flake8-per-file-ignoreplugin dependency - Adds default values to the
flake8 --helpoutput - Adds
doas a restricted variable name - Forbids multiple assignment targets for context managers
- Forbids to use incorrect multi-line parameters
- Forbids to use
boolvalues as positional arguments - Forbids 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
exceptblocks
- Fixes tests failing on windows (@sobolevn hates windows!), but it still fails sometimes
- Fixes bug when
@staticmethodwas treated as a module member - Fixes 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 underscored - Fixes bug when assignment to anything rather than name was raising an error
- Refactoring: now we fix
asyncnodes offset in a special transformation - Improves docs: specifies what
transformationis - Improves docs: making contributing section in the
READMEmore friendly - Improves build: changes how CI installs
poetry
- Fixes all possible errors that happen
because of unset
parentandfunction_typeproperties
- Breaking: removes
--max-conditionsand--max-elifsoptions - Breaking: removes
--max-offset-blocks - Breaking: changes default
TooManyConditionsViolationthreshold from3to4 - Breaking: changes
TooManyBaseClassesViolationcode from225to215 - Forbids to use
lambdainside loops - Forbids to use
self,cls, andmcsexcept for first arguments only - Forbids 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 names - Now
RedundantLoopElseViolationalso checkswhileloops
- Fixes
TooManyConditionsViolationto work with any conditions, not justifs - Fixes
TooManyConditionsViolationthat did not count conditions correctly - Fixes
TooManyForsInComprehensionViolationto find all comprehension types - Fixes
TooManyElifsViolationto check module level conditions - Fixes
TooManyBaseClassesViolationdocs location - Fixes
WrongVariableNameViolationnot checkinglambdaargument names - Fixes
OffsetVisitorincorrectawaithandling
- Refactoring: moves all complexity checks into
complexity/folder - Refactoring: 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 allastexamples - Improves tests: now we are sure about correct order of violations
Development was focused around better test coverage and providing a better API for tests. We also now covering more cases and testing violation texts.
- Breaking: removes duplicating module name rules, now we use the same rules for both variables and modules
- Breaking: removes
--min-module-name-lengthoptions - Breaking: renames
--min-variable-name-lengthinto--min-name-length - Dependencies: updates
flake8version to3.6 - Dependencies: removes
pycodestylepinned version - Restrict unicode names
- Multiple fixes to error text formats to be more readable
- Fixes
UNDERSCORED_NUMBER_PATTERNto match names likecome_22_me - Fixes
UpperCaseAttributeViolationnot being displayed in the docs - Fixes consistency checks being duplicated in the docs
- Fixes
UnderscoredNumberNameViolationshowing incorrect line number - Fixes
ProtectedAttributeViolationto respectsuper()andmcs - Fixes
ProtectedAttributeViolationto show correct text - Fixes
BadNumberSuffixViolationto show correct text - Fixes
TooManyBaseClassesViolationto show correct text - Fixes
TooManyElifsViolationto show correct text - Fixes
TooDeepNestingViolationto show correct text - Fixes
TooManyMethodsViolationto show correct text - Fixes
ReassigningVariableToItselfViolationto show correct text - Renames
UnderscoredNumberNameViolationtoUnderscoredNumberNameViolation
- 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 patterns live in related
conftest.py - Improves docs: now all configuration options are listed in the violations
This release was made possible by awesome people who contributed
to the project during #hactoberfest. List of awesome people:
- @novikovfred
- @riyasyash
- @sathwikmatsa
- @tipabu
- @roxe322
- @geoc0ld
- @lensvol
- @SheldonNunes
- @tommbee
- @valignatev
- @vsmaxim
- Adds
flake8-printas a dependency - Adds
typing-extensionsas a dependency - Forbids to use
quitandexitfunctions - Forbids 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
lambdafunctions - Forbids extra
objectin parent classes list - Forbids
forloops with unusedelse - Forbids variables self reassignment
- Forbids
trywithfinallywithoutexcept - Forbids
ifstatements with invalid conditionals - Forbids opening parenthesis from following keyword without space in between them
- Forbids the use of more than 2
forloops within a comprehension - Forbids 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
- Fixes that
MultipleIfsInComprehensionViolationwas not enabled - Fixes flaky behaviour of
test_module_namestest package - Fixed
TooManyMethodsViolationnot displaying line number in output - Fixed
OffsetVisitordue to python bug
- Updates
poetryversion - Refactoring: some general changes, including better names and APIs
- Improves docs: now we have
versionaddedfor each violation - Improves 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 structure - Improves 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
noqachecks - Improves 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
finalto indicate what should not be changed - Improves types: now we do not have any ugly import hacks
This release was made possible by awesome people who contributed
to the project during #hactoberfest. List of awesome people:
- Now we are counting
asyncfunction as a module member - We now forbid to use
credits()builtin function - We now check
async forandasync withnesting level - We now check
async forandasync withvariable names - We now count
asyncmethods as method for classes complexity check - We now count
asyncfunctions as functions for module complexity check - We now check
asyncfunctions names and arguments - We now count
asyncfunctions complexity - We now ignore
asyncfunctions in jones complexity check - We now check for nested
asyncfunctions - We now check for
asyncfunctions with@staticmethoddecorator
- 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
asynccomprehensions
- Breaking: changes violation codes, now they are grouped by meaning
- 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
- Adds
flake8-logging-formatdependency - Adds
flake8-type-annotationsdependency - Adds
flake8-breaking-linedependency - Removes
flake8-super-calldependency - Adds
PartialFloatViolation - Adds
MagicNumberViolation - Adds
WrongDocCommentViolation - Adds
MAGIC_NUMBERS_WHITELISTconstant - Changes what variable names are blacklisted, adds
false,true, andno
- Improves docs: now including docs for
--max-conditionoption - Improves docs: adds some new
Zen of Pythonreferences - Improves 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
- Adds
MultipleIfsInComprehensionViolation - Adds
TooManyConditionsViolation - Adds
--max-conditionsoption
- Improves
CONTRIBUTING.md - Moves issues templates to
.github/folder - Update error thrown on
RedundantSubscriptViolation
- Adds
WrongModuleNamePatternViolationandWrongModuleNameUnderscoresViolation - Adds
TooManyImportsViolationerror and--max-importsoption - Adds
--i-control-codeoption to ignoreInitModuleHasLogicViolation - Adds check for underscored numbers
- Forbids
u''strings - Adds
noqaandtypecomments checks
- 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 withtokenize - Improves typing support
- Adds
flake8-banditplugin - Adds
flake8-eradicateplugin - Adds
flake8-printplugin for development - Removes
delegateconcept from the codebase
- Adds
jonescomplexity checker - Adds
--max-line-complexityand--max-jones-scoreoptions
- Improves docs: adds detailed installation instructions
- Removes
flake8-blind-exceptplugin
This is just a supporting release. There are no new features introduced.
We have changed the error codes for general checks.
- Fixes bug with nested imports missing
parent - Fixes bug with incorrect
pycodestyleversion - Removes
BareRaiseViolationas it does not fit the purpose of this package
- 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
bugandrule-request - Replaced
pytest-isortwithflake8-isort
This is just a supporting release. There are no new features introduced.
- 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
sphinxdocs structure a little bit
- Adds
WrongModuleNameViolation,WrongModuleMagicNameViolation, andTooShortModuleNameViolation - Adds
--min-module-name-lengthconfig option - Adds a blacklist of module names
- Adds
InitModuleHasLogicsViolation - Adds
EmptyModuleViolation - Adds a whitelist of magic module names
- Fixes
Optionclass to have have incorrecttypefield, now using strings - Fixes that
WrongStringTokenVisitorwas not activated
- Improved typing support
- Now each error has a link to the corresponding constant (if any)
- Improved docs with links to the corresponding configuration flags
This is just a supporting release. There are no new features introduced.
- Fixes
Attribute has no 'id'error - Fixes
missing 'typing_extension'error
- Errors are now tested
- Complexity tests are refactored
- 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
TooDeepNestingViolationandTooManyElifsViolationchecks - Adds
--max-offset-blocksand--max-elifsoptions - Adds
TooManyModuleMembersViolationandTooManyMethodsViolationchecks - Adds
--max-module-membersand--max-methodsoptions - Restricts to use
fstrings
- Removes incorrect
generic_visit()calls - Removes some unused
getattr()calls - Refactors how options are registered
- Improved type support for options parsing
- Added new magic methods to the black list
- We now do not count
_as a variable inTooManyLocalscheck - We now restrict to nest
lambdas - We now allow to configure the minimal variable's name length via
setup.cfg
- 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 raise - Changed how visitors are initialized in tests
- Tests now cover nested classes' explicit bases
- Tests now cover nested classes and functions
noqacomment
- We now check import aliases to be different from the original name
- Default complexity checks' values have changed
- ReadTheDocs build is fixed by providing extra dependencies
- Changed how local variables are counted
- Improved typing support
- Added new documentation sections
- We now allow
generator_stopto be a__future__import - We now restrict dotted raw imports like:
import os.path - We now check import aliases as regular variable names
- We have added a
CONTRIBUTING.mdfile to help new contributors
- We now check
classes to match our styleguide - Classes have their own error group
Z3 - Using
@staticmethodis now forbidden - Declaring
objectas a base class is now required - Now we check that
__del__magic method is not used - Variable names
asyncandawaitare forbidden - We now forbid to use
__future__imports - We now have a whitelist for
__future__imports - Imports are now have its own subgroup
Z10 - General rules now start from
Z11
- We now use
Zas the default code for our errors - We 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
Moduleraises an error - Adds
fileandklassas restricted names - Now
__import__is just a bad function name, not a special case - Now version is defined in
poetry.tomlonly - We now have configuration! And it covers all design errors
- Fixes issue with missing
parents :batman: - Fixes issue with
_$NAMEpatterns being ignored
- Adds some new blacklisted variables' names
- Adds docs for each existing error code
- Adds whitelisted names for nested functions:
decoratorandfactory - Adds new blacklisted module's metadata variables
- Removed
BAD_IMPORT_FUNCTIONSvariable, now just checking__import__
- Add gen-tests that cover most of the issues
- Removed almost all integration tests, saving just a few of them
- Adds
poetryas the main project tool - Adds
shpinxas a documentation tool
- Initial release