wemake-python-styleguide icon indicating copy to clipboard operation
wemake-python-styleguide copied to clipboard

WPS221 wrong case

Open k-kov opened this issue 1 year ago • 0 comments

What's wrong

NAME = Literal['S', 'N', 'B', 'BOOL', 'NULL', 'M', 'L', 'SS', 'NS', 'BS']

This line is considered as WPS221 Found line with high Jones Complexity: 15 > 14 , but it is just declaration, should not be considered for such error. Also, it is impossible to split this line into smaller pieces to reduce complexity by the rule.

From docs:

What nodes do we count? All except the following:

modules function and classes, since they are checked differently type annotations, since they do not increase the complexity

How it should be

WPS221 should not be triggered

Flake8 version and plugins

{ "platform": { "python_implementation": "CPython", "python_version": "3.9.6", "system": "Darwin" }, "plugins": [ { "plugin": "darglint", "version": "1.8.1" }, { "plugin": "flake8-bandit", "version": "4.1.1" }, { "plugin": "flake8-broken-line", "version": "1.0.0" }, { "plugin": "flake8-bugbear", "version": "23.11.26" }, { "plugin": "flake8-commas", "version": "2.1.0" }, { "plugin": "flake8-comprehensions", "version": "3.14.0" }, { "plugin": "flake8-debugger", "version": "4.1.2" }, { "plugin": "flake8-docstrings", "version": "1.7.0" }, { "plugin": "flake8-eradicate", "version": "1.5.0" }, { "plugin": "flake8-isort", "version": "6.1.1" }, { "plugin": "flake8-quotes", "version": "3.3.2" }, { "plugin": "flake8-rst-docstrings", "version": "0.3.0" }, { "plugin": "flake8-string-format", "version": "0.3.0" }, { "plugin": "mccabe", "version": "0.7.0" }, { "plugin": "pep8-naming", "version": "0.13.3" }, { "plugin": "pycodestyle", "version": "2.11.1" }, { "plugin": "pyflakes", "version": "3.1.0" }, { "plugin": "wemake-python-styleguide", "version": "0.18.0" } ], "version": "6.1.0" }

pip information

annotated-types==0.6.0 astor==0.8.1 attrs==23.1.0 bandit==1.7.5 blinker==1.7.0 boto3==1.33.3 botocore==1.33.3 certifi==2023.11.17 chardet==5.2.0 charset-normalizer==3.3.2 click==8.1.7 darglint==1.8.1 deepdiff==6.7.1 docutils==0.20.1 eradicate==2.3.0 flake8==6.1.0 flake8-bandit==4.1.1 flake8-broken-line==1.0.0 flake8-bugbear==23.11.26 flake8-commas==2.1.0 flake8-comprehensions==3.14.0 flake8-debugger==4.1.2 flake8-docstrings==1.7.0 flake8-eradicate==1.5.0 flake8-isort==6.1.1 flake8-quotes==3.3.2 flake8-rst-docstrings==0.3.0 flake8-string-format==0.3.0 Flask==3.0.0 future==0.18.3 gitdb==4.0.11 GitPython==3.1.40 idna==3.6 importlib-metadata==6.8.0 isort==5.12.0 itsdangerous==2.1.2 Jinja2==3.1.2 jmespath==1.0.1 markdown-it-py==3.0.0 MarkupSafe==2.1.3 mccabe==0.7.0 mdurl==0.1.2 mysql-connector-python==8.2.0 ordered-set==4.1.0 pbr==6.0.0 pep8-naming==0.13.3 protobuf==4.21.12 pycodestyle==2.11.1 pydantic==2.3.0 pydantic_core==2.6.3 pydocstyle==6.3.0 pyflakes==3.1.0 Pygments==2.17.2 PyJWT==2.8.0 python-dateutil==2.8.2 PyYAML==6.0.1 requests==2.31.0 requests-toolbelt==1.0.0 restructuredtext-lint==1.4.0 rich==13.7.0 s3transfer==0.8.2 six==1.16.0 smmap==5.0.1 snowballstemmer==2.2.0 stevedore==5.1.0 typing_extensions==4.8.0 urllib3==1.26.18 webexteamssdk==1.6.1 wemake-python-styleguide==0.18.0 Werkzeug==3.0.1 zipp==3.17.0

OS information

ProductName: macOS ProductVersion: 14.4.1 BuildVersion: 23E224

k-kov avatar Apr 09 '24 18:04 k-kov