Sha256: c9f9b8a8c122e1b43878fd9050b01ae08b68eac22581e55f48f24f0389614000

Contents?: true

Size: 684 Bytes

Versions: 46

Compression:

Stored size: 684 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Naming
      # This cop 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.'

        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

46 entries across 27 versions & 3 rubygems

Version Path
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/rubocop-0.79.0/lib/rubocop/cop/naming/class_and_module_camel_case.rb
rubocop-0.81.0 lib/rubocop/cop/naming/class_and_module_camel_case.rb
rubocop-0.80.1 lib/rubocop/cop/naming/class_and_module_camel_case.rb
rubocop-0.80.0 lib/rubocop/cop/naming/class_and_module_camel_case.rb
grape-extra_validators-1.0.0 vendor/bundle/ruby/2.6.0/gems/rubocop-0.79.0/lib/rubocop/cop/naming/class_and_module_camel_case.rb
grape-extra_validators-1.0.0 vendor/bundle/ruby/2.4.0/gems/rubocop-0.79.0/lib/rubocop/cop/naming/class_and_module_camel_case.rb
rubocop-0.79.0 lib/rubocop/cop/naming/class_and_module_camel_case.rb
rubocop-0.78.0 lib/rubocop/cop/naming/class_and_module_camel_case.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/rubocop-0.74.0/lib/rubocop/cop/naming/class_and_module_camel_case.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/rubocop-0.76.0/lib/rubocop/cop/naming/class_and_module_camel_case.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/rubocop-0.75.1/lib/rubocop/cop/naming/class_and_module_camel_case.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/rubocop-0.75.0/lib/rubocop/cop/naming/class_and_module_camel_case.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/rubocop-0.72.0/lib/rubocop/cop/naming/class_and_module_camel_case.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/rubocop-0.77.0/lib/rubocop/cop/naming/class_and_module_camel_case.rb
rubocop-0.77.0 lib/rubocop/cop/naming/class_and_module_camel_case.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/rubocop-0.76.0/lib/rubocop/cop/naming/class_and_module_camel_case.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/rubocop-0.72.0/lib/rubocop/cop/naming/class_and_module_camel_case.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/rubocop-0.75.0/lib/rubocop/cop/naming/class_and_module_camel_case.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/rubocop-0.74.0/lib/rubocop/cop/naming/class_and_module_camel_case.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/rubocop-0.75.1/lib/rubocop/cop/naming/class_and_module_camel_case.rb