Skip to content

Commit 1d22edf

Browse files
committed
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 ```
1 parent c2713ae commit 1d22edf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/rubocop/cop/performance/redundant_merge.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def correct_multiple_elements(corrector, node, parent, new_source)
109109
node = parent
110110
else
111111
padding = "\n#{leading_spaces(node)}"
112-
new_source.gsub!(/\n/, padding)
112+
new_source.gsub!("\n", padding)
113113
end
114114

115115
corrector.replace(node, new_source)
@@ -132,7 +132,7 @@ def to_assignments(receiver, pairs)
132132
def rewrite_with_modifier(node, parent, new_source)
133133
indent = ' ' * configured_indentation_width
134134
padding = "\n#{indent + leading_spaces(node)}"
135-
new_source.gsub!(/\n/, padding)
135+
new_source.gsub!("\n", padding)
136136

137137
format(WITH_MODIFIER_CORRECTION, keyword: parent.loc.keyword.source,
138138
condition: parent.condition.source,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy