class RuboCop::Cop::Minitest::LifecycleHooksOrder
def on_class(class_node)
def on_class(class_node) return unless test_class?(class_node) previous_index = -1 previous_hook_node = nil hooks_and_test_cases(class_node).each do |node| hook = node.method_name index = HOOKS_ORDER_MAP[hook] if index < previous_index message = format(MSG, current: hook, previous: previous_hook_node.method_name) add_offense(node, message: message) do |corrector| autocorrect(corrector, previous_hook_node, node) end end previous_index = index previous_hook_node = node end end