Sha256: d1c47db778ca5c336de2fa9179207dd667c9b904b206f98cbfadd5675cfa3a38

Contents?: true

Size: 514 Bytes

Versions: 2

Compression:

Stored size: 514 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    module Style
      # This cop checks for uses of the class/module name instead of
      # self, when defining class/module methods.
      class ClassMethods < Cop
        MSG = 'Prefer self over class/module for class/module methods.'

        # TODO: Check if we're in a class/module
        def on_defs(node)
          definee, _name, _args, _body = *node

          add_offense(definee, :name) if definee.type == :const
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubocop-0.19.1 lib/rubocop/cop/style/class_methods.rb
rubocop-0.19.0 lib/rubocop/cop/style/class_methods.rb