mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 10:48:32 +00:00
Normalize '\r' in string literals to '\n'
<!-- Thank you for contributing to Ruff! To help us out with reviewing, please consider the following: - Does this pull request include a summary of the change? (See below.) - Does this pull request include a descriptive title? - Does this pull request include references to any relevant issues? --> ## Summary This PR normalizes line endings inside of strings to `\n` as required by the printer. <!-- What's the purpose of the change? What does it do, and why? --> ## Test Plan I added a new test using `\r\n` and ran the ecosystem check. There are no remaining end of line panics. https://gist.github.com/MichaReiser/8f36b1391ca7b48475b3a4f592d74ff4 <!-- How was it tested? -->
This commit is contained in:
parent
dc65007fe9
commit
f9129e435a
5 changed files with 93 additions and 41 deletions
|
@ -0,0 +1,26 @@
|
|||
---
|
||||
source: crates/ruff_python_formatter/tests/fixtures.rs
|
||||
input_file: crates/ruff_python_formatter/resources/test/fixtures/ruff/carriage_return/string.py
|
||||
---
|
||||
## Input
|
||||
```py
|
||||
'This string will not include \
|
||||
backslashes or newline characters.'
|
||||
|
||||
"""Multiline
|
||||
String \"
|
||||
"""
|
||||
```
|
||||
|
||||
## Output
|
||||
```py
|
||||
"This string will not include \
|
||||
backslashes or newline characters."
|
||||
|
||||
"""Multiline
|
||||
String \"
|
||||
"""
|
||||
```
|
||||
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue