Releases: wemake-services/wemake-python-styleguide
Version 1.0.0 with full `ruff` support
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
flake8
plugins - 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 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.9
support - Breaking: Drops
nitpick
support - 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-naming
support, useruff format
andruff check
instead - Breaking: Drops
darglint
support, because it is unmaintained - Breaking: Removes
WPS113
, because is covered bypylint
linter - Breaking: Removes
WPS119
, because is covered bypylint
linter - Breaking: Removes
WPS125
, because it is covered byruff
linter - Breaking: Removes
WPS302
, because it is covered byruff
formatter - Breaking: Removes
WPS304
, because it is covered byruff
formatter - Breaking: Removes
WPS305
, because it is covered byruff
formatter - Breaking: Removes
WPS306
, because it is covered byruff
formatter - Breaking: Removes
WPS309
, because it is covered byruff
formatter - Breaking: Removes
WPS310
, because it is covered byruff
formatter - Breaking: Removes
WPS313
, because it is covered byruff
formatter - Breaking: Removes
WPS315
, because it is covered byruff
formatter - Breaking: Removes
WPS316
, because it is covered byruff
linter - Breaking: Removes
WPS317
, because it is covered byruff
formatter - Breaking: Removes
WPS318
, because it is covered byruff
formatter - Breaking: Removes
WPS319
, because it is covered byruff
formatter - Breaking: Removes
WPS320
, because it is covered byruff
formatter - Breaking: Removes
WPS323
, because it is covered byruff
formatter - Breaking: Removes
WPS326
, because it is covered byruff
linter - Breaking: Removes
WPS329
, because it is covered byruff
linter - Breaking: Removes
WPS331
, because it is covered byruff
linter - Breaking: Removes
WPS333
, because is covered bypylint
linter - Breaking: Removes
WPS337
, because it is covered byruff
formatter - Breaking: Removes
WPS340
, because it is covered byruff
formatter - Breaking: Removes
WPS341
, because it is covered byruff
formatter - Breaking: Removes
WPS343
, because it is covered byruff
formatter - Breaking: Removes
WPS348
, because it conflicts withruff
formatter - Breaking: Removes
WPS351
, because it is covered byruff
linter - Breaking: Removes
WPS352
, because it is covered byruff
formatter - Breaking: Removes
WPS355
, because it is covered byruff
formatter - Breaking: Removes
WPS360
, because it is covered byruff
formatter - Breaking: Removes
WPS361
, because it is covered byruff
formatter - Breaking: Removes
WPS415
, because is covered byruff
linter - Breaking: Removes
WPS417
, because is covered byruff
linter - Breaking: Removes
WPS419
, because is covered byruff
linter - Breaking: Removes
WPS423
, because is covered byruff
linter - Breaking: Removes
WPS424
, because is covered byruff
linter - Breaking: Removes
WPS425
, because is covered byruff
linter - Breaking: Removes
WPS428
, because is covered byruff
linter - Breaking: Removes
WPS433
, because is covered bypylint
linter - Breaking: Removes
WPS434
, because is covered bypylint
linter - Breaking: Removes
WPS436
, because is covered bypylint
linter - Breaking: Removes
WPS437
, because is covered byruff
linter - 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 bypylint
linter - Breaking: Removes
WPS452
, because is covered byruff
linter - Breaking: Removes
WPS454
, because is covered byruff
linter - Breaking: Removes
WPS456
, because is covered byruff
linter - Breaking: Removes
WPS465
, because|
is now heavily used by typing - Breaking: Removes
WPS467
, because is covered bypylint
linter - Breaking: Removes
WPS502
, because is covered byruff
linter - Breaking: Removes
WPS503
, because is covered byruff
linter - Breaking: Removes
WPS507
, because is covered bypylint
linter - Breaking: Removes
WPS508
, because is covered byruff
linter - Breaking: Removes
WPS510
, because is covered bypylint
linter - Breaking: Removes
WPS514
, because is covered bypylint
linter - Breaking: Removes
WPS528
, because is covered bypylint
linter - Breaking: Removes
WPS525
, because is covered byruff
linter - Breaking: Removes
WPS526
, because is covered byruff
linter - Breaking: Removes
WPS521
, because is covered byruff
linter - Breaking: Removes
WPS609
, because is covered bypylint
linter - Breaking: Removes
--i-control-code
setting,
if you want to disable some violations, just use# noqa
or--ignore
with code that you want to exclude, there's no need
to create one more way of disabling some specific violations
Features
- Adds official
python3.13
support - Allows any compares in
assert
statements forWPS520
, #3112 - Allows walrus operator (
:=
) in comprehesions, #3121 - Allows
pass
incase
bodies, #2642 - Allows subclassing builtins in
WPS600
, when creating anEnum
, #2506 - Allows using variables after blocks for
WPS441
inassert
statements, #2543 - Does not count
self
,cls
, andmcs
as arguments
forWPS211
complexity check anymore, #2394 - Allows underscores (
_
) with exactly 3 digits after it inWPS303
, #3120 - Allows class / instance attribute shadowing
in@dataclass
es forWPS601
, #1926 - Allows any number of instance attributes on
@dataclass
es inWPS230
, #2448 - Allows any number of function parameters
in@overload
definitions forWPS211
, #1957 - Allows using multiline strings when placed on separate lines, #3056
- Allows using
hasattr
builtin function, #2228 - Disallows using
is not
andnot in
as negated conditions inWPS504
, #2617 - Allows all branches in
if/elif/else
to be negated inWPS504
, #2617 - Adds a new rule to forbid
lambda
assigns to special attributes, #1733 - Adds a new rule to check problematic function params, #1343
- Adds a new rule to detect duplicate conditions in
if
s andelif
s, #2241 - Adds a new rule to detect duplicate
case
pattens inmatch
, #3206 - Adds a new rule to find too many
match
subjects, #3201 - Adds a new rule to detect too many
case
statements, #3202 - Adds a new rule to find too complex
except
with too many exceptions - Adds a new rule to find too many
PEP695
type params - Adds a new rule to find useless ternary expressions, #1706
- Adds a new rule to forbid
raise SystemExit
, usesys.exit
instead, #1786 - Adds a new rule to forbid extra syntax in
match ...
subjects, #3217 - Adds new
--allowed-module-metadata
and--forbidden-module-metadata
configuration options forWPS410
, #3060 - Now
--allowed-domain-names
also affectWPS11
to allow custom short variable names, #2554 - Adds support to run
wemake-python-styleguide
as apre-commit
hook, #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
Bugfixes
- Fixes
WPS217
to allow simple calls inf
strings, #3150 - Fixes
WPS217
not to raise on emptyf
strings,
becauseruff check
handles that now for us - Fi...
Version 0.19.2
Bugfixes
- Fixes
WrongEmptyLinesCountViolation
crash onCallable[..., ...]
#2899
Version 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
TooDeepNestingViolation
not to trigger
on...
in functions and classes - Fixes
StatementHasNoEffectViolation
not to trigger
on...
in functions and classes, when it is the only node
Version 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.12
support - Breaking: drops
python3.8
support - Breaking: Reconsider
object
required base class exception:
sinceclass Klass[_Type]
must not containobject
,
this rule is change to be the opposite:
object
explicit base class must not be used.
You can useruff
to 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 bymypy
when usingConcatenate
- Adds support for naming rules for PEP695 type params
- Due to how
f
-string are parsed inpython3.12
several token-based
violations are not reported anymore for them:
WrongMultilineStringViolation
,ImplicitRawStringViolation
,
WrongUnicodeEscapeViolation
,RawStringNotNeededViolation
wemake
output formatter now respectsNO_COLOR=1
option
to disable text highlighting. See https://no-color.org- Adds
ImportObjectCollisionViolation
to detect
the same objects imported under different aliases - Adds
reveal_locals
to the list of forbidden functions - Updates
flake8
to7.x
Bugfixes
- Fixes
ForbiddenInlineIgnoreViolation
config parsing. #2590 - Fixes
WrongEmptyLinesCountViolation
for func definitions with ellipsis. #2847 - Fixes
WrongEmptyLinesCountViolation
for multiline implicit string concatination. #2787 - Fixes
ObjectInBaseClassesListViolation
,UnpythonicGetterSetterViolation
,
ImplicitInConditionViolation
,RedundantSubscriptViolation
,
TooLongCompareViolation
to include better error details - Fixes
TooDeepNestingViolation
forTryStar
andMatch
statements - Fixes
TooLongTryBodyViolation
andTooManyExceptCasesViolation
to work forTryStar
statements as well - Fixes
UselessNodeViolation
to work withTryStar
- Fixes
DuplicateExceptionViolation
to work withTryStar
- Fixes
TryExceptMultipleReturnPathViolation
to work withTryStar
- Fixes
IncorrectExceptOrderViolation
to work withTryStar
- Fixes that
MatchStar
was not checked in pattern matching name assignments - Fixes pattern matching support
inBlockAndLocalOverlapViolation
andOuterScopeShadowingViolation
Misc
- Updates multiple
flake8-*
dependencies - Fixes multiple typos in docs
Version 0.18.0
Features
- Breaking: drops
python3.7
support, because it has almost reached its EOL - Adds
python3.11
support - Bump
flake8
to version5.x
- Bump
flake8-*
dependencies to newer versions - Added
ChainedIsViolation
#2443 - Added
BuggySuperContextViolation
#2310
Bugfixes
- Make
generic_visit()
check script properly handlewith
statements. - Allow calling magic methods with the same name as the enclosing method #2381
- Fix WrongEmptyLinesCountViolation false positive #2531
- Fix OpenWithoutContextManagerViolation false positive #2577
Misc
- Replaced
flakehell
mentions toflakeheaven
#2409
Version 0.17.0
Features
- Breaking: drops
python3.6
support - Adds support for pattern matching naming rules, same as other variables
- Adds
--show-violation-links
option to show links to violation docs - Adds
__init_subclass__
in the beginning of accepted methods
order as per WPS338 #2411 - Adds
WrongEmptyLinesCountViolation
to check
for too many lines in functions and methods definitions #2486
Bugfixes
- Fixes
WPS226
false positives on|
use inSomeType | AnotherType
type hints syntax - Now
-1
is 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
Misc
Version 0.16.1
Version 0.16.0
Features
- Supports new
flake8
version4.x
- Now
InconsistentYieldViolation
andInconsistentReturnViolation
are raised
whenyield
orreturn
is used withNone
where plain version should be used #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 DirectMagicAttributeAccessViolation
now only flags instances for which
a known alternative exists #2268- Forbids getting collection element of list by unpacking #1824
- Now
WPS227
forbids returning tuples that are too long #1731
Bugfixes
- Fixes that
InconsistentComprehensionViolation
was ignoring
misalignedin
expressions #2075 - Fixes some common magic methods not being recognized as such #2281
Misc
- Removes all
Raises:
from docstrings, they were unused - Improve Docs: Fixed all typos and grammatical errors in
CHANGELOG.md
- Updated documentation with the recommended
isort
config. #1934 - Updates
typing_extensions
to4.x
Version 0.15.3
Bugfixes
- Fixes crash on
python3.10
- Fixes
UselessReturningElseViolation
to not reportelse
withbreak
#1958 - Fixes
ReassigningVariableToItselfViolation
to not report onx = (x,)
#1807 - Fixes
ReassigningVariableToItselfViolation
to extract variables
from unary operators #1874 - Fixes that
f'{some:,}'
was considered too complex #1921 - Fixes that
range(len(x))
was not allowed even outsidefor
loops #1883
Misc
- Adds documentation (and tests) for how to run project on Jupyter Notebooks
- Updates
mypy
to0.902
and fixes type issues
Version 0.15.2
Bugfixes
- Fixes
BitwiseAndBooleanMixupViolation
work with PEP 604 union types #1884 - Fixes
CognitiveModuleComplexityViolation
to not trigger
for a single-item modules - Fixes that
ConstantConditionViolation
was not reported for aBoolOp
- Functions and methods marked as
@overload
or@typing.overload
do not count in complexity rules
Misc
- Updates GitHub Action's base Python image version to
3.8.8