From 1d22edf4550392efea19346d09a3df9ccd63b2b6 Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Tue, 20 Jun 2023 16:20:32 +0900 Subject: [PATCH] Suppress new `Style/RedundantRegexpArgument` offenses This PR suppresses the following new `Style/RedundantRegexpArgument` offenses: ```console $ bundle exec rake (snip) Offenses: lib/rubocop/cop/performance/redundant_merge.rb:112:30: C: [Correctable] Style/RedundantRegexpArgument: Use string "\n" as argument instead of regexp /\n/. new_source.gsub!(/\n/, padding) ^^^^ lib/rubocop/cop/performance/redundant_merge.rb:135:28: C: [Correctable] Style/RedundantRegexpArgument: Use string "\n" as argument instead of regexp /\n/. new_source.gsub!(/\n/, padding) ^^^^ 116 files inspected, 2 offenses detected, 2 offenses autocorrectable ``` --- lib/rubocop/cop/performance/redundant_merge.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rubocop/cop/performance/redundant_merge.rb b/lib/rubocop/cop/performance/redundant_merge.rb index 80fd392108..7e6060ef1b 100644 --- a/lib/rubocop/cop/performance/redundant_merge.rb +++ b/lib/rubocop/cop/performance/redundant_merge.rb @@ -109,7 +109,7 @@ def correct_multiple_elements(corrector, node, parent, new_source) node = parent else padding = "\n#{leading_spaces(node)}" - new_source.gsub!(/\n/, padding) + new_source.gsub!("\n", padding) end corrector.replace(node, new_source) @@ -132,7 +132,7 @@ def to_assignments(receiver, pairs) def rewrite_with_modifier(node, parent, new_source) indent = ' ' * configured_indentation_width padding = "\n#{indent + leading_spaces(node)}" - new_source.gsub!(/\n/, padding) + new_source.gsub!("\n", padding) format(WITH_MODIFIER_CORRECTION, keyword: parent.loc.keyword.source, condition: parent.condition.source,