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

DOC501 throwing errors when using Sphinx style docstrings #12520

Open
Eutropios opened this issue Jul 26, 2024 · 2 comments · May be fixed by #13286
Open

DOC501 throwing errors when using Sphinx style docstrings #12520

Eutropios opened this issue Jul 26, 2024 · 2 comments · May be fixed by #13286
Labels
docstring Related to docstring linting or formatting preview Related to preview mode features

Comments

@Eutropios
Copy link
Contributor

Eutropios commented Jul 26, 2024

def foo(bar: int) -> float:
    """
    Minimal docstring.

    :param bar: Bar
    :raises ValueError: Foo bar.
    :return baz: Baz
    """
    if bar:
        raise ValueError
    return 0.1

Command used:
ruff check --select DOC --preview .

Ruff version:
Ruff v0.5.5

Description of bug:
Ruff throws a warning for DOC501 when the docstring already documents the thrown exceptions.

Output:

project/foo.py:150:15: DOC501 Raised exception `ValueError` missing from docstring
    |
148 |     """
149 |     if bar:
150 |         raise ValueError
    |               ^^^^^^^^^^ DOC501
151 |     return 0.1
@charliermarsh charliermarsh added bug Something isn't working docstring Related to docstring linting or formatting preview Related to preview mode features labels Jul 26, 2024
@charliermarsh
Copy link
Member

I believe this is a TODO per #12434.

@charliermarsh charliermarsh removed the bug Something isn't working label Jul 26, 2024
@Eutropios
Copy link
Contributor Author

Ahhh, my mistake! Thanks for the quick response. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docstring Related to docstring linting or formatting preview Related to preview mode features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants