astral-sh / astral-sh/ruff

Use self-documenting f-strings where possible

Open
#4,302 7 comments 3 reactions 0 assignees View on GitHub
rule
Dominant language
Rust
Stars
49.6k
Forks
2.4k
Avg merge
2d 1h
Merged PRs (30d)
458

Description

Could maybe be added to `flake8-simplify`.

```py
my_var = 42_000

# bad (if target=py3.8+)
f"my_var={my_var}"
f"my_var = {my_var}"
f"my_var = {my_var:,}"

# good
f"{my_var=}"
f"{my_var = }"
f"{my_var = :,}"
```

Contributor guide

Open the contributing guide

Research direction

Review the flake8-simplify proposal and Ruff's existing lint-rule entry points for Python f-strings. Confirm how the target Python version is represented and how similar suggestions are tested. Done means eligible f-strings receive a diagnostic recommending self-documenting syntax, including the formatting examples shown.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.