class RuboCop::Cop::Style::IfInsideElse

end
action_c
else
action_b
elsif condition_b
action_a
if condition_a
# good
end
end
action_c
else
action_b
if condition_b
else
action_a
if condition_a
# bad
@example
This helps to keep the nesting level from getting too deep.
it can be combined with the ‘else` to become an `elsif`.
If the `else` branch of a conditional consists solely of an `if` node,

def on_if(node)

def on_if(node)
  return if node.ternary? || node.unless?
  else_branch = node.else_branch
  return unless else_branch && else_branch.if_type? && else_branch.if?
  add_offense(else_branch, location: :keyword)
end