From e3aaf605f0179ea554f5133a7e11079400012b7f Mon Sep 17 00:00:00 2001 From: Sidney Souza Date: Fri, 15 Dec 2023 17:33:20 -0300 Subject: [PATCH] chore: add mixed option for quote_style Sometimes when we are working in a legacy code formatting a string changing its quote style is not something we really want because it makes a PR review hard as a lot of modifications may be made. With this option a developer can choose if that modification is needed or not issue: https://github.com/ruby-formatter/rufo/issues/258 --- docs/settings.md | 3 + lib/rufo/formatter.rb | 1 + lib/rufo/settings.rb | 2 +- .../mixed_quotes.rb.spec | 69 +++++++++++++++++++ 4 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 spec/lib/rufo/formatter_source_specs/mixed_quotes.rb.spec diff --git a/docs/settings.md b/docs/settings.md index 12b132b2..d2a44ac9 100644 --- a/docs/settings.md +++ b/docs/settings.md @@ -227,6 +227,7 @@ Use the specified quotation marks. - `:double`: (default) use doublequotations unless one or more escaped double-quotations are included - `:single`: use single quotations unless one or more interpolations `#{}` or escaped single quotations are included +- `:mixed`: use mixed quotations if you don't want to change quotes This does not affect `%q()` (single), `%Q()` (double), or quotation marks within heredocs. @@ -278,6 +279,8 @@ code = <