Sha256: da49aa1a90dba9f37f2b83664e1a7da49b9ed9f545387572ddcfc7078fdaaaee

Contents?: true

Size: 559 Bytes

Versions: 5

Compression:

Stored size: 559 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    module Style
      # This cops checks for class and module names with
      # an underscore in them.
      class ClassAndModuleCamelCase < Cop
        MSG = 'Use CamelCase for classes and modules.'

        def on_class(node)
          check_name(node)
        end

        def on_module(node)
          check_name(node)
        end

        private

        def check_name(node)
          name = node.loc.name.source

          convention(node, :name) if name =~ /_/
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubocop-0.15.0 lib/rubocop/cop/style/class_and_module_camel_case.rb
rubocop-0.14.1 lib/rubocop/cop/style/class_and_module_camel_case.rb
rubocop-0.14.0 lib/rubocop/cop/style/class_and_module_camel_case.rb
rubocop-0.13.1 lib/rubocop/cop/style/class_and_module_camel_case.rb
rubocop-0.13.0 lib/rubocop/cop/style/class_and_module_camel_case.rb