wemake-services / wemake-python-styleguide

The strictest and most opinionated python linter ever!
https://wemake-python-styleguide.rtfd.io
MIT License
2.55k stars 378 forks source link

False positive WPS420 and WPS604 on empty class #3054

Closed Xoriun closed 2 months ago

Xoriun commented 2 months ago

What's wrong

I need an empty class (custom Exception), so I just write

class MyException(RuntimeError):
    pass

which gives me an WPS420 and WPS 604 on the pass keyword.

How it should be

Since afaik there is no other way to create such an empty class, there should be an exception to WPS420 and WPS604 for this specific usecase.

Flake8 version and plugins

{ "platform": { "python_implementation": "CPython", "python_version": "3.12.6", "system": "Windows" }, "plugins": [ { "plugin": "flake8-bandit", "version": "4.1.1" }, { "plugin": "flake8-broken-line", "version": "1.0.0" }, { "plugin": "flake8-bugbear", "version": "24.4.26" }, { "plugin": "flake8-commas", "version": "2.1.0" }, { "plugin": "flake8-comprehensions", "version": "3.15.0" }, { "plugin": "flake8-debugger", "version": "4.1.2" }, { "plugin": "flake8-docstrings", "version": "1.7.0" }, { "plugin": "flake8-docstrings-complete", "version": "1.3.0" }, { "plugin": "flake8-eradicate", "version": "1.5.0" }, { "plugin": "flake8-isort", "version": "6.1.1" }, { "plugin": "flake8-quotes", "version": "3.4.0" }, { "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.12.1" }, { "plugin": "pyflakes", "version": "3.2.0" }, { "plugin": "wemake-python-styleguide", "version": "0.19.2" } ], "version": "7.1.1" }

pip information

pip 24.2 from C:\Users\Praktikant\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip (python 3.12) aiofiles==24.1.0 aiohappyeyeballs==2.3.5 aiohttp==3.10.3 aiosignal==1.3.1 altgraph==0.17.4 anyio==4.4.0 astor==0.8.1 attrs==24.2.0 auto-py-to-exe==2.44.1 babel==2.16.0 bandit==1.7.9 bottle==0.12.25 bottle-websocket==0.2.9 certifi==2024.7.4 cffi==1.17.0 chardet==5.2.0 charset-normalizer==3.3.2 ci-info==0.3.0 click==8.1.7 colorama==0.4.6 configobj==5.0.8 configparser==7.0.0 docutils==0.21.2 Eel==0.17.0 eradicate==2.3.0 et-xmlfile==1.1.0 etelemetry==0.3.1 filelock==3.15.4 fitz==0.0.1.dev2 flake8==7.1.1 flake8-bandit==4.1.1 flake8-broken-line==1.0.0 flake8-bugbear==24.4.26 flake8-commas==2.1.0 flake8-comprehensions==3.15.0 flake8-debugger==4.1.2 flake8-docstrings==1.7.0 flake8-docstrings-complete==1.3.0 flake8-eradicate==1.5.0 flake8-isort==6.1.1 flake8-quotes==3.4.0 flake8-rst-docstrings==0.3.0 flake8-string-format==0.3.0 frontend==0.0.3 frozenlist==1.4.1 future==1.0.0 gevent==24.2.1 gevent-websocket==0.10.1 greenlet==3.0.3 h11==0.14.0 httplib2==0.22.0 idna==3.7 iso8601==2.1.0 isodate==0.6.1 isort==5.13.2 itsdangerous==2.2.0 looseversion==1.3.0 lxml==5.3.0 markdown-it-py==3.0.0 mccabe==0.7.0 mdurl==0.1.2 multidict==6.0.5 networkx==3.3 nibabel==5.2.1 nipype==1.8.6 numpy==2.0.1 openpyxl==3.1.5 packaging==24.1 pandas==2.2.2 pathlib==1.0.1 pbr==6.0.0 pefile==2023.2.7 pep8-naming==0.13.3 pillow==10.4.0 prov==2.0.1 py-cord==2.6.0 pyasn1==0.6.0 pycodestyle==2.12.1 pycparser==2.22 pydocstyle==6.3.0 pydot==3.0.1 pyflakes==3.2.0 Pygments==2.18.0 pyinstaller==6.10.0 pyinstaller-hooks-contrib==2024.8 PyMuPDF==1.24.9 PyMuPDFb==1.24.9 pyparsing==3.1.2 pypdfium2==4.30.0 pyserial==3.5 PySimpleGUI==5.0.6 python-dateutil==2.9.0.post0 pytz==2024.1 pywin32-ctypes==0.2.3 pyxnat==1.6.2 PyYAML==6.0.2 rdflib==7.0.0 reportlab==4.2.2 requests==2.32.3 restructuredtext-lint==1.4.0 rich==13.7.1 rsa==4.9 scipy==1.14.0 setuptools==72.2.0 simplejson==3.19.2 six==1.16.0 sniffio==1.3.1 snowballstemmer==2.2.0 starlette==0.38.2 stevedore==5.2.0 traits==6.4.3 typing_extensions==4.12.2 tzdata==2024.1 urllib3==2.2.2 uvicorn==0.30.6 wemake-python-styleguide==0.19.2 whichcraft==0.6.1 yarl==1.9.4 zope.event==5.0 zope.interface==7.0.1

OS information

Windows 10

sobolevn commented 2 months ago

Thanks for the report, but this is expected.

class MyException(RuntimeError):
    """Instead of `pass` document why do you need this error."""