class RuboCop::Cop::Lint::DuplicateElsifCondition


end
do_something_else
elsif x == 2
do_something
if x == 1
# good
end
do_something_else
elsif x == 1
do_something
if x == 1
# bad
@example
Checks that there are no repeated conditions used in if ‘elsif’.

def on_if(node)

def on_if(node)
  previous = []
  while node.if? || node.elsif?
    condition = node.condition
    add_offense(condition) if previous.include?(condition)
    previous << condition
    node = node.else_branch
    break unless node&.if_type?
  end
end