class Rubocop::Cop::Style::ClassMethods

This cop checks for uses of the class/module name instead of self, when defining class/module methods.

Constants

MSG

Public Instance Methods

on_defs(node) click to toggle source

TODO - check if we’re in a class/module

# File lib/rubocop/cop/style/class_methods.rb, line 12
def on_defs(node)
  definee, _name, _args, _body = *node

  if definee.type == :const
    add_offence(:convention, definee.loc.name, MSG)
  end
end