Skip to content

Commit

Permalink
Suppress new Style/RedundantRegexpArgument offenses
Browse files Browse the repository at this point in the history
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
```
  • Loading branch information
koic committed Jun 20, 2023
1 parent c2713ae commit 1d22edf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/rubocop/cop/performance/redundant_merge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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,
Expand Down

0 comments on commit 1d22edf

Please sign in to comment.