update command comparison to *commands vararg
This commit is contained in:
parent
3db65e7ee5
commit
ea4fb0fe09
@ -521,9 +521,12 @@ module RuboCop
|
|||||||
return if offenses.blank?
|
return if offenses.blank?
|
||||||
|
|
||||||
T.must(offenses[0...-1]).each_with_index do |node, i|
|
T.must(offenses[0...-1]).each_with_index do |node, i|
|
||||||
# executable and subcmd have to be the same to be combined
|
# commands have to be the same to be combined
|
||||||
if node.arguments.first != offenses[i + 1].arguments.first ||
|
# send_type? matches `bin/"foo"`, str_type? matches remaining command parts,
|
||||||
node.arguments.second != offenses[i + 1].arguments.second
|
# the rest are kwargs we need to filter out
|
||||||
|
method_commands = node.arguments.filter { |arg| arg.send_type? || arg.str_type? }
|
||||||
|
next_method_commands = offenses[i + 1].arguments.filter { |arg| arg.send_type? || arg.str_type? }
|
||||||
|
unless method_commands == next_method_commands
|
||||||
shells.delete_at(i)
|
shells.delete_at(i)
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user