mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-24 05:25:17 +00:00
Prefer the configured quote style
<!-- 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 extends the string formatting to respect the configured quote style. <!-- What's the purpose of the change? What does it do, and why? --> ## Test Plan Extended the string test with new cases and set it up to run twice: Once with the `quote_style: Doube`, and once with `quote_style: Single` single and double quotes. <!-- How was it tested? -->
This commit is contained in:
parent
f18a1f70de
commit
313711aaf9
5 changed files with 165 additions and 24 deletions
8
crates/ruff_python_formatter/resources/test/fixtures/ruff/expression/string.options.json
vendored
Normal file
8
crates/ruff_python_formatter/resources/test/fixtures/ruff/expression/string.options.json
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
[
|
||||
{
|
||||
"quote_style": "double"
|
||||
},
|
||||
{
|
||||
"quote_style": "single"
|
||||
}
|
||||
]
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
# Prefer double quotes for string with equal amount of single and double quotes
|
||||
'" \' " " \'\''
|
||||
"' \" '' \" \" '"
|
||||
"' \" '' \" \""
|
||||
|
||||
"\\' \"\""
|
||||
'\\\' ""'
|
||||
|
@ -47,6 +47,16 @@ String ""
|
|||
String """
|
||||
'''
|
||||
|
||||
'''Multiline
|
||||
String "'''
|
||||
|
||||
"""Multiline
|
||||
String '''
|
||||
"""
|
||||
|
||||
"""Multiline
|
||||
String '"""
|
||||
|
||||
'''Multiline
|
||||
String \"\"\"
|
||||
'''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue