[Feature request] Indentation for ternary statements
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 49.7k
- Forks
- 2.4k
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 458
Description
Ternary statements that are broken across multiple lines are indented at the same level as the parent line, making them very hard to read, especially if surrounded by additional logic. Prettier handles the equivalent case in JS/TS by adding an indentation level to the ternaries. This would likely need to be behind a flag for ease of migration from Black, but ideally this would be the only behavior if that constraint didn't exist.
Ruff
Prettier
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating Ruff's formatter handling for multiline Python ternary statements and compare its output with the examples in the issue and Prettier's behavior. Determine how migration compatibility and any flag would be specified, then add coverage showing the intended indentation and verify existing formatting behavior remains compatible.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100