diff options
-rw-r--r-- | .rubocop.yml | 3 | ||||
-rw-r--r-- | lib/gitlab/diff/parser.rb | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/.rubocop.yml b/.rubocop.yml index 9f179efa3ce..c96c7123c16 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -990,11 +990,12 @@ Performance/RedundantSortBy: # string. Performance/StartWith: Enabled: false + # Use `tr` instead of `gsub` when you are replacing the same number of # characters. Use `delete` instead of `gsub` when you are deleting # characters. Performance/StringReplacement: - Enabled: false + Enabled: true # TODO: Enable TimesMap Cop. # Checks for `.times.map` calls. diff --git a/lib/gitlab/diff/parser.rb b/lib/gitlab/diff/parser.rb index d0815fc7eea..6fe7faa547a 100644 --- a/lib/gitlab/diff/parser.rb +++ b/lib/gitlab/diff/parser.rb @@ -18,7 +18,7 @@ module Gitlab @lines.each do |line| next if filename?(line) - full_line = line.gsub(/\n/, '') + full_line = line.delete("\n") if line.match(/^@@ -/) type = "match" |