Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
webknjaz opened this issue Sep 27, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@webknjaz
Copy link
Contributor

webknjaz commented Sep 27, 2024

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

@webknjaz webknjaz added the bug Something isn't working label Sep 27, 2024
@sobolevn
Copy link
Member

Valid use-case, thank you!

webknjaz added a commit to webknjaz/ansible--awx-plugins that referenced this issue Oct 1, 2024
It's hitting false-positives with attribute docstrings.

Ref: wemake-services/wemake-python-styleguide#3056
webknjaz added a commit to webknjaz/ansible--awx-plugins that referenced this issue Oct 1, 2024
It's hitting false-positives with attribute docstrings.

Ref: wemake-services/wemake-python-styleguide#3056
webknjaz added a commit to webknjaz/ansible--awx-plugins that referenced this issue Oct 1, 2024
It's hitting false-positives with attribute docstrings.

Ref: wemake-services/wemake-python-styleguide#3056
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants