Skip to content

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

@webknjaz

Description

@webknjaz

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions