wemake-services / wemake-python-styleguide

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

[false positive] Multiline rules get triggered for PEP 224 attribute docstrings #3056

Open webknjaz opened 1 month ago

webknjaz commented 1 month ago

What's wrong

Sphinx documentation generator relies on attribute docstrings to document class attributes. It's a very old convention which has been in place for nearly two decades. Despite the formal rejection of PEP 224, these docstrings are still widely used in practice, in the context of API doc generation via Sphinx.

WPS should not prevent such legitimate use.

How it should be

Attribute docstrings should not trigger any of WPS322, WPS428 or WPS462.

The following should be allowed and not trigger linting violations:

from dataclasses import dataclass

@dataclass
class SomeStructure:
    """A class explanation."""

    id: str
    """An attribute explanation."""

Flake8 version and plugins

N/A

pip information

N/A

OS information

N/A

sobolevn commented 1 month ago

Valid use-case, thank you!