Merge pull request #4396 from Homebrew/dep-order-cop-fix
DependencyOrder: Fix var initialization bug
This commit is contained in:
commit
fac11c2f16
@ -58,9 +58,8 @@ module RuboCop
|
|||||||
ordered.each_with_index do |dep, pos|
|
ordered.each_with_index do |dep, pos|
|
||||||
idx = pos+1
|
idx = pos+1
|
||||||
match_nodes = build_with_dependency_name(dep)
|
match_nodes = build_with_dependency_name(dep)
|
||||||
idx1 = pos if match_nodes && !match_nodes.empty?
|
next if !match_nodes || match_nodes.empty?
|
||||||
next unless idx1
|
idx1 = pos
|
||||||
idx2 = nil
|
|
||||||
ordered.drop(idx1+1).each_with_index do |dep2, pos2|
|
ordered.drop(idx1+1).each_with_index do |dep2, pos2|
|
||||||
next unless match_nodes.index(dependency_name(dep2))
|
next unless match_nodes.index(dependency_name(dep2))
|
||||||
idx2 = pos2 if idx2.nil? || pos2 > idx2
|
idx2 = pos2 if idx2.nil? || pos2 > idx2
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user