class Rubocop::Cop::Style::ColonMethodCall

This cop checks for methods invoked via the

operator instead

of the . operator (like FileUtils::rmdir instead of FileUtils.rmdir).

Constants

MSG

Public Instance Methods

autocorrect_action(node) click to toggle source
# File lib/rubocop/cop/style/colon_method_call.rb, line 23
def autocorrect_action(node)
  replace(node.loc.dot, '.')
end
on_send(node) click to toggle source
Calls superclass method
# File lib/rubocop/cop/style/colon_method_call.rb, line 11
def on_send(node)
  receiver, _method_name, *_args = *node

  # discard methods with nil receivers and op methods(like [])
  if receiver && node.loc.dot && node.loc.dot.is?('::')
    add_offence(:convention, node.loc.dot, MSG)
    do_autocorrect(node)
  end

  super
end