Add ability to disable multi-line string concatenation with ruff format
- Dominant language
- Rust
- Stars
- 49.6k
- Forks
- 2.4k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 435
Description
### Summary
Please change ruff format's behaviour for concatenating multi-line strings.
For example:
```py
outputFile.write(
"\n"
f"\n"
f"{xmlEscape(source)}\n"
"\n"
"\n",
)
```
Should not concatenate to
```py
outputFile.write(
f"\n\n{xmlEscape(source)}\n\n\n",
)
```
I cannot find a way to disable this behaviour - or disabling string concatenation in general when using ruff format.
Any suggestions on how to use ruff format without multiline string concatenation would be helpful.
### Reasoning
Multi-line strings split over new lines is usually a very intended form of syntax.
Splitting strings over multiple lines at fixed positions helps with readability.
I think there is more value in disabling this feature for ruff format than having it enabled.
Contributor guide
Research direction
Start by tracing Ruff format's handling of adjacent multi-line Python string literals and how formatter options are defined and applied. Check the existing formatter tests, if present, for string concatenation behavior; done means a documented configuration can disable this concatenation while preserving the requested split strings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100