-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Labels
bugSomething isn't workingSomething isn't workingdocstringRelated to docstring linting or formattingRelated to docstring linting or formatting
Description
Summary
Possibly related to #16578 but somewhat different: Text after the Raises
block triggers a false positive for DOC502 if that text contains a colon.
In my case, the relevant part of the docstring contains Sphinx directives, properly unindented:
Raises:
ExtraneousDataError:
``exact`` is True and there's data left over at the end of the byte
string.
.. versionadded:: 0.7.0
The ``init_kwargs`` argument.
This results in a false positive:
Raised exception is not explicitly raised: `. versionadded` (DOC502) [Ln 7, Col 5]
Note the line number is also wrong; it's line 27 of the docstring, line 6 of the Raises
section if you include the line with "Raises" on it.
It seems like Ruff thinks versionadded:
is part of the Raises
block, even though it's unindented. Interestingly, removing both colons from versionadded
makes the issue go away. Adding just one back triggers the bug again.
Playground link: https://play.ruff.rs/2f264f7b-d661-4af3-83e0-2db04e30ced8
Version
0.12.0
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingdocstringRelated to docstring linting or formattingRelated to docstring linting or formatting