class RuboCop::Cop::Style::IfInsideElse
def autocorrect(corrector, node)
def autocorrect(corrector, node) if then?(node) # If the nested `if` is a then node, correct it first, # then the next pass will use `correct_to_elsif_from_if_inside_else_form` IfThenCorrector.new(node, indentation: 0).call(corrector) return end if node.modifier_form? correct_to_elsif_from_modifier_form(corrector, node) else correct_to_elsif_from_if_inside_else_form(corrector, node, node.condition) end corrector.remove(range_by_whole_lines(find_end_range(node), include_final_newline: true)) return unless (if_branch = node.if_branch) range = range_by_whole_lines(if_branch.source_range, include_final_newline: true) corrector.remove(range) end