mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 18:58:04 +00:00
[pydocstyle
] Handle arguments with the same names as sections (D417
) (#16011)
## Summary Fixes #16007. The logic from the last fix for this (#9427) was sufficient, it just wasn't being applied because `Attributes` sections aren't expected to have nested sections. I just deleted the outer conditional, which should hopefully fix this for all section types. ## Test Plan New regression test, plus the existing D417 tests.
This commit is contained in:
parent
df1d430294
commit
7b487d853a
6 changed files with 150 additions and 77 deletions
|
@ -176,4 +176,45 @@ def f(x, *args, **kwargs):
|
|||
x: the value
|
||||
*args: var-arguments
|
||||
"""
|
||||
return x
|
||||
return x
|
||||
|
||||
|
||||
# regression test for https://github.com/astral-sh/ruff/issues/16007.
|
||||
# attributes is a section name without subsections, so it was failing the
|
||||
# previous workaround for Args: args: sections
|
||||
def send(payload: str, attributes: dict[str, Any]) -> None:
|
||||
"""
|
||||
Send a message.
|
||||
|
||||
Args:
|
||||
payload:
|
||||
The message payload.
|
||||
|
||||
attributes:
|
||||
Additional attributes to be sent alongside the message.
|
||||
"""
|
||||
|
||||
|
||||
# undocumented argument with the same name as a section
|
||||
def should_fail(payload, Args):
|
||||
"""
|
||||
Send a message.
|
||||
|
||||
Args:
|
||||
payload:
|
||||
The message payload.
|
||||
"""
|
||||
|
||||
|
||||
# documented argument with the same name as a section
|
||||
def should_not_fail(payload, Args):
|
||||
"""
|
||||
Send a message.
|
||||
|
||||
Args:
|
||||
payload:
|
||||
The message payload.
|
||||
|
||||
Args:
|
||||
The other arguments.
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue