class RuboCop::Cop::Style::MethodMissing

end
super

def method_missing(…)
end

def respond_to_missing?(…)
#good
end

def method_missing(…)
#bad
@example
defining ‘respond_to_missing?` and falling back on `super`.
This cop checks for the presence of `method_missing` without also

def calls_super?(node)

def calls_super?(node)
  node.descendants.any?(&:zsuper_type?)
end

def check(node)

def check(node)
  return if calls_super?(node) && implements_respond_to_missing?(node)
  add_offense(node, :expression)
end

def implements_respond_to_missing?(node)

def implements_respond_to_missing?(node)
  node.parent.each_child_node(node.type).any? do |sibling|
    if node.def_type?
      respond_to_missing_def?(sibling)
    elsif node.defs_type?
      respond_to_missing_defs?(sibling)
    end
  end
end

def message(node)

def message(node)
  instructions = []
  unless implements_respond_to_missing?(node)
    instructions << 'define `respond_to_missing?`'.freeze
  end
  unless calls_super?(node)
    instructions << 'fall back on `super`'.freeze
  end
  format(MSG, instructions.join(' and '))
end

def on_method_def(node, method_name, _args, _body)

def on_method_def(node, method_name, _args, _body)
  return unless method_name == :method_missing
  check(node)
end