class RuboCop::Cop::Style::EachWithObject

def on_block(node)

def on_block(node)
  each_with_object_block_candidate?(node) do |method, args, body|
    _, method_name, method_arg = *method
    return if simple_method_arg?(method_arg)
    return_value = return_value(body)
    return unless return_value
    return unless first_argument_returned?(args, return_value)
    return if accumulator_param_assigned_to?(body, args)
    message = format(MSG, method: method_name)
    add_offense(method.loc.selector, message: message) do |corrector|
      autocorrect_block(corrector, node, return_value)
    end
  end
end