astral-sh / astral-sh/ruff

`section-underline-matches-section-length` (`D409`) should warn on all titles instead of a list of known ones

Open
#9,727 0 comments 0 reactions 0 assignees View on GitHub
rule
Dominant language
Rust
Stars
49.6k
Forks
2.4k
Avg merge
2d 1h
Merged PRs (30d)
445

Description

it seems that this rule only cares about specific titles ("Example", "Parameters", "Raises", "Returns") but i don't see why it can't just check every title

```py
def foo(): # error
"""
example:
-----------
asdf
"""

def bar(): # no error
"""
asdf:
--------
asdf
"""
```

https://play.ruff.rs/a10dd179-6047-43c4-97b1-5083e68008a1

Contributor guide

Open the contributing guide

Research direction

Start with the implementation of rule D409 (`section-underline-matches-section-length`) and reproduce the examples in the linked Ruff Playground. Update the rule so an underline mismatch is reported for arbitrary section titles, then verify that the demonstrated `foo` case warns while the `bar` case does not.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.