mirror of
https://github.com/astral-sh/ruff.git
synced 2025-11-03 21:24:29 +00:00
[pydocstyle] Fix D413 infinite loop for parenthesized docstring (#18930)
<!-- Thank you for contributing to Ruff/ty! To help us out with reviewing, please consider the following: - Does this pull request include a summary of the change? (See below.) - Does this pull request include a descriptive title? (Please prefix with `[ty]` for ty pull requests.) - Does this pull request include references to any relevant issues? --> ## Summary <!-- What's the purpose of the change? What does it do, and why? --> Fixes #18908
This commit is contained in:
parent
eb9d9c3646
commit
9f0d3cca89
3 changed files with 32 additions and 2 deletions
|
|
@ -69,3 +69,11 @@ def func():
|
||||||
Returns:
|
Returns:
|
||||||
the value
|
the value
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
def func():
|
||||||
|
("""Docstring.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
ValueError: An error.
|
||||||
|
""")
|
||||||
|
|
|
||||||
|
|
@ -1717,7 +1717,7 @@ fn common_section(
|
||||||
format!(
|
format!(
|
||||||
"{}{}",
|
"{}{}",
|
||||||
line_end.repeat(2 - num_blank_lines),
|
line_end.repeat(2 - num_blank_lines),
|
||||||
docstring.compute_indentation()
|
leading_space(docstring.compute_indentation())
|
||||||
),
|
),
|
||||||
context.end() - del_len,
|
context.end() - del_len,
|
||||||
context.end(),
|
context.end(),
|
||||||
|
|
|
||||||
|
|
@ -79,5 +79,27 @@ D413.py:69:5: D413 [*] Missing blank line after last section ("Returns")
|
||||||
69 69 | Returns:
|
69 69 | Returns:
|
||||||
70 70 | the value
|
70 70 | the value
|
||||||
71 |- """
|
71 |- """
|
||||||
71 |+
|
72 71 |
|
||||||
72 |+ """
|
72 |+ """
|
||||||
|
73 |+
|
||||||
|
73 74 |
|
||||||
|
74 75 | def func():
|
||||||
|
75 76 | ("""Docstring.
|
||||||
|
|
||||||
|
D413.py:77:5: D413 [*] Missing blank line after last section ("Raises")
|
||||||
|
|
|
||||||
|
75 | ("""Docstring.
|
||||||
|
76 |
|
||||||
|
77 | Raises:
|
||||||
|
| ^^^^^^ D413
|
||||||
|
78 | ValueError: An error.
|
||||||
|
79 | """)
|
||||||
|
|
|
||||||
|
= help: Add blank line after "Raises"
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
76 76 |
|
||||||
|
77 77 | Raises:
|
||||||
|
78 78 | ValueError: An error.
|
||||||
|
79 |+
|
||||||
|
79 80 | """)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue