mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-26 11:59:10 +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
2
crates/ruff_python_formatter/resources/test/fixtures/ruff/carriage_return/.editorconfig
vendored
Normal file
2
crates/ruff_python_formatter/resources/test/fixtures/ruff/carriage_return/.editorconfig
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
[*.py]
|
||||
end_of_line = crlf
|
1
crates/ruff_python_formatter/resources/test/fixtures/ruff/carriage_return/.gitattributes
vendored
Normal file
1
crates/ruff_python_formatter/resources/test/fixtures/ruff/carriage_return/.gitattributes
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
* text=auto eol=crlf
|
6
crates/ruff_python_formatter/resources/test/fixtures/ruff/carriage_return/string.py
vendored
Normal file
6
crates/ruff_python_formatter/resources/test/fixtures/ruff/carriage_return/string.py
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
'This string will not include \
|
||||
backslashes or newline characters.'
|
||||
|
||||
"""Multiline
|
||||
String \"
|
||||
"""
|
Loading…
Add table
Add a link
Reference in a new issue