Request: Remove sequential blank lines in docstrings
- Dominant language
- Rust
- Stars
- 49.6k
- Forks
- 2.4k
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 458
Description
I'd like a way to get rid of extraneous whitespace in docstrings.
Here's an example of a docstring with way too much whitespace:
```python
def cool_function(x: int) -> None:
"""
Do nothing.
Parameters
----------
x
Description of x.
Notes
-----
Hello.
There.
"""
```
I'd like ruff to format this down to:
```python
def cool_function(x: int) -> None:
"""
Do nothing.
Parameters
----------
x
Description of x.
Notes
-----
Hello.
There.
"""
```
On a related note, there is currently no way to make sure there is _no_ blank line after the last section (the opposite of `D413`). This would be a useful lint to have!
Contributor guide
Research direction
The issue names no files or tests. Start by locating Ruff's existing docstring formatting and D413 lint implementations, then inspect their test coverage; done means sequential blank lines are normalized and trailing blank-line behavior is defined and covered for the examples shown.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, rust
- Domain
- documentation, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100