-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
bugSomething isn't workingSomething isn't workingformatterRelated to the formatterRelated to the formatterlinterRelated to the linterRelated to the linter
Description
Thank you for the great tool. I am encountering an issue with the docstring code formatter in dynamic mode.
When the doctest code has an indent that is more than the docstring indent, the dynamic calculation is off, and as a result, the formatter and the linter are in a disagreement.
I have searched the issue using "doctest", "docstring", "dynamic" keywords. #9126 is for the bug where this calculation if off for the prompt. The current issue is for when the prompt is extra indented.
"""example.py file."""
def length(numbers: list[int]) -> int:
"""Get the length of the given list of numbers.
Args:
numbers: List of numbers.
Returns:
Integer length of the list of numbers.
Example:
>>> length([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])
20
"""
return len(numbers)# pyproject.toml
[tool.ruff.format]
docstring-code-format = true
[tool.ruff.lint]
select = ['D', 'E']
[tool.ruff.lint.pydocstyle]
convention = "google"
$ ruff --version
ruff 0.6.4
$ ruff format example.py
1 file left unchanged
$ ruff check example.py
example.py:14:89: E501 Line too long (91 > 88)
|
13 | Example:
14 | >>> length([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])
| ^^^ E501
15 | 20
16 | """
|
Found 1 error.I am happy to take a stab at this.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingformatterRelated to the formatterRelated to the formatterlinterRelated to the linterRelated to the linter