Sha256: 822137b528ab8f2f482ac1687993ee5bf5e3f21abd5066dacb0e2e99be074c25

Contents?: true

Size: 692 Bytes

Versions: 16

Compression:

Stored size: 692 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Naming
      # This cops checks for class and module names with
      # an underscore in them.
      #
      # @example
      #   # bad
      #   class My_Class
      #   end
      #   module My_Module
      #   end
      #
      #   # good
      #   class MyClass
      #   end
      #   module MyModule
      #   end
      class ClassAndModuleCamelCase < Cop
        MSG = 'Use CamelCase for classes and modules.'.freeze

        def on_class(node)
          return unless node.loc.name.source =~ /_/

          add_offense(node, location: :name)
        end
        alias on_module on_class
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
rubocop-0.59.2 lib/rubocop/cop/naming/class_and_module_camel_case.rb
rubocop-0.59.1 lib/rubocop/cop/naming/class_and_module_camel_case.rb
rubocop-0.59.0 lib/rubocop/cop/naming/class_and_module_camel_case.rb
rubocop-0.58.2 lib/rubocop/cop/naming/class_and_module_camel_case.rb
rubocop-0.58.1 lib/rubocop/cop/naming/class_and_module_camel_case.rb
rubocop-0.58.0 lib/rubocop/cop/naming/class_and_module_camel_case.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/rubocop-0.57.2/lib/rubocop/cop/naming/class_and_module_camel_case.rb
rubocop-0.57.2 lib/rubocop/cop/naming/class_and_module_camel_case.rb
rubocop-0.57.1 lib/rubocop/cop/naming/class_and_module_camel_case.rb
rubocop-0.57.0 lib/rubocop/cop/naming/class_and_module_camel_case.rb
rubocop-0.56.0 lib/rubocop/cop/naming/class_and_module_camel_case.rb
rubocop-0.55.0 lib/rubocop/cop/naming/class_and_module_camel_case.rb
rubocop-0.54.0 lib/rubocop/cop/naming/class_and_module_camel_case.rb
rubocop-0.53.0 lib/rubocop/cop/naming/class_and_module_camel_case.rb
rubocop-0.52.1 lib/rubocop/cop/naming/class_and_module_camel_case.rb
rubocop-0.52.0 lib/rubocop/cop/naming/class_and_module_camel_case.rb