class RuboCop::Cop::InternalAffairs::OnSendWithoutOnCSend

end
alias_method :on_csend, :on_send
end
# …
def on_send(node)
class MyCop < RuboCop::Cop:Base
# good - alias_method
end
alias on_csend on_send
end
# …
def on_send(node)
class MyCop < RuboCop::Cop:Base
# good - alias
end
end
# …
def on_csend(node)
end
# …
def on_send(node)
class MyCop < RuboCop::Cop:Base
# good - explicit method definition
end
end
# …
def on_send(node)
class MyCop < RuboCop::Cop:Base
# bad
@example
make sense to support safe navigation.
macros like ‘attr_reader`, DSL methods, etc.), and other checks that wouldn’t
method calls that will never have a receiver (ruby keywords like ‘raise`,
on receivers that cannot be nil (`self`, a literal, a constant), and
NOTE: It is expected to disable this cop for cops that check for method calls
`send` node.
it is good practice to handle safe navigation methods if handling any
will never be used with the code checked by a specific cop, in general
Although in some cases it can be predetermined that safe navigation
Checks for cops that define `on_send` without define `on_csend`.

def on_alias(node)

def on_alias(node)
  @on_send_definition = node if node.new_identifier.value == :on_send
  @on_csend_definition = node if node.new_identifier.value == :on_csend
end

def on_def(node)

def on_def(node)
  @on_send_definition = node if node.method?(:on_send)
  @on_csend_definition = node if node.method?(:on_csend)
end

def on_investigation_end

def on_investigation_end
  return unless @on_send_definition && !@on_csend_definition
  add_offense(@on_send_definition)
end

def on_new_investigation

def on_new_investigation
  @on_send_definition = nil
  @on_csend_definition = nil
end

def on_send(node) # rubocop:disable InternalAffairs/OnSendWithoutOnCSend

rubocop:disable InternalAffairs/OnSendWithoutOnCSend
def on_send(node) # rubocop:disable InternalAffairs/OnSendWithoutOnCSend
  new_identifier = node.first_argument
  return unless new_identifier.basic_literal?
  new_identifier = new_identifier.value
  @on_send_definition = node if new_identifier == :on_send
  @on_csend_definition = node if new_identifier == :on_csend
end