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:
Micha Reiser 2023-06-26 14:24:25 +02:00 committed by GitHub
parent f18a1f70de
commit 313711aaf9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 165 additions and 24 deletions

View file

@ -0,0 +1,8 @@
[
{
"quote_style": "double"
},
{
"quote_style": "single"
}
]

View file

@ -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 \"\"\"
'''