Remove WPS2xx rules that are managed by Ruff
What's wrong
In version 1.0.0 many rules were removed in favour of the same rules in Ruff. Why some of the WPS2xx rules were not removed, even though they have a counterpart in Ruff? For example: WPS210, WPS211, WPS213, WPS231 are covered by Ruff PLR0912, PLR0913, PLR0914, PLR0917, C901
How it should be
Some of the WPS2xx rules should be removed
Flake8 version and plugins
{ "platform": { "python_implementation": "CPython", "python_version": "3.12.8", "system": "Darwin" }, "plugins": [ { "plugin": "mccabe", "version": "0.7.0" }, { "plugin": "pycodestyle", "version": "2.12.1" }, { "plugin": "pyflakes", "version": "3.2.0" }, { "plugin": "wemake-python-styleguide", "version": "1.0.0" } ], "version": "7.1.1" }
pip information
OS information
Sadly, we cannot do that, because they have other (wrong 🌚️️) defaults. We cannot force people to configure all rules properly :(
@sobolevn Then maybe it's better to document it somewhere and suggest how to configure Ruff to replace these rules?
Yeap, feel free to send a PR with .. note:: on these rules.
Looks like WPS211 could be replaced by PLR0913, both have 5 as the default value.
But PLR0913 doesn't count args and kwargs:
class AppValidator(OAuth2Validator):
def validate_user(
self,
username: str,
password: str,
client: Client,
request: Request,
*args: None,
**kwargs: None,
) -> bool:
...
➤ uvx ruff check --select PLR0913
All checks passed!
➤ uv run flake8 --select=WPS211
src/validator.py
11:5 WPS211 Found too many arguments: 6 > 5
def validate_user(
^
WPS211: Found too many arguments: 6 > 5
1 ./src/validator.py
Total: 1
All errors: 1
Full list of violations and explanations:
https://wemake-python-styleguide.rtfd.io/en/1.1.0/pages/usage/violations/
class AppValidator(OAuth2Validator):
def validate_user(
self,
username: str,
password: str,
client: Client,
request: Request,
a: int,
b: int,
*args: None,
**kwargs: None,
) -> bool:
...
➤ uvx ruff check --select PLR0913
src/validator.py:11:9: PLR0913 Too many arguments in function definition (6 > 5)
|
10 | class AppValidator(OAuth2Validator):
11 | def validate_user(
| ^^^^^^^^^^^^^ PLR0913
12 | self,
13 | username: str,
|
Found 1 error.
➤ uv run flake8 --select=WPS211
src/validator.py
11:5 WPS211 Found too many arguments: 8 > 5
def validate_user(
^
WPS211: Found too many arguments: 8 > 5
1 ./src/validator.py
Total: 1
All errors: 1
Full list of violations and explanations:
https://wemake-python-styleguide.rtfd.io/en/1.1.0/pages/usage/violations/
Also, PLR0913 knows about typing.override:
from typing import override
class AppValidator(OAuth2Validator):
@override
def validate_user(
self,
username: str,
password: str,
client: Client,
request: Request,
a: int,
b: int,
*args: None,
**kwargs: None,
) -> bool:
➤ uvx ruff check --select PLR0913
All checks passed!
➤ uv run flake8 --select=WPS211
src/validator.py
13:5 WPS211 Found too many arguments: 8 > 5
def validate_user(
^
WPS211: Found too many arguments: 8 > 5
1 ./src/validator.py
Total: 1
All errors: 1
Full list of violations and explanations:
https://wemake-python-styleguide.rtfd.io/en/1.1.0/pages/usage/violations/
Yes, this is fine :) PR is welcome!