Browse Source

code cleanup: rubocop: fix Style/WhileUntilModifier in lib/redmine/unified_diff.rb

git-svn-id: http://svn.redmine.org/redmine/trunk@18759 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/4.1.0
Toshi MARUYAMA 4 years ago
parent
commit
163e6eb6f7
2 changed files with 4 additions and 3 deletions
  1. 0
    1
      .rubocop_todo.yml
  2. 4
    2
      lib/redmine/unified_diff.rb

+ 0
- 1
.rubocop_todo.yml View File

@@ -1446,7 +1446,6 @@ Style/VariableInterpolation:
Style/WhileUntilModifier:
Exclude:
- 'app/models/attachment.rb'
- 'lib/redmine/unified_diff.rb'
- 'lib/redmine/utils.rb'

# Cop supports --auto-correct.

+ 4
- 2
lib/redmine/unified_diff.rb View File

@@ -203,11 +203,13 @@ module Redmine
if line_left.present? && line_right.present? && line_left != line_right
max = [line_left.size, line_right.size].min
starting = 0
while starting < max && line_left[starting] == line_right[starting]
while starting < max &&
line_left[starting] == line_right[starting]
starting += 1
end
ending = -1
while ending >= -(max - starting) && (line_left[ending] == line_right[ending])
while ending >= -(max - starting) &&
(line_left[ending] == line_right[ending])
ending -= 1
end
unless starting == 0 && ending == -1

Loading…
Cancel
Save