Sha256: e725c48f0013ac2397992e89ad54bf91d3a757d9999abc17ff27ba3481da9cc3

Contents?: true

Size: 520 Bytes

Versions: 14

Compression:

Stored size: 520 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    class ClassAndModuleCamelCase < Cop
      ERROR_MESSAGE = 'Use CamelCase for classes and modules.'

      def inspect(file, source, tokens, sexp)
        [:class, :module].each do |keyword|
          each(keyword, sexp) do |s|
            if s[1][0] == :const_ref && s[1][1][0] == :@const &&
                s[1][1][1] =~ /_/
              add_offence(:convention, s[1][1][2].lineno, ERROR_MESSAGE)
            end
          end
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rubocop-0.7.2 lib/rubocop/cop/class_and_module_camel_case.rb
rubocop-0.7.1 lib/rubocop/cop/class_and_module_camel_case.rb
rubocop-0.7.0 lib/rubocop/cop/class_and_module_camel_case.rb
rubocop-0.6.1 lib/rubocop/cop/class_and_module_camel_case.rb
rubocop-0.6.0 lib/rubocop/cop/class_and_module_camel_case.rb
rubocop-0.5.0 lib/rubocop/cop/class_and_module_camel_case.rb
rubocop-0.4.6 lib/rubocop/cop/class_and_module_camel_case.rb
rubocop-0.4.5 lib/rubocop/cop/class_and_module_camel_case.rb
rubocop-0.4.4 lib/rubocop/cop/class_and_module_camel_case.rb
rubocop-0.4.3 lib/rubocop/cop/class_and_module_camel_case.rb
rubocop-0.4.2 lib/rubocop/cop/class_and_module_camel_case.rb
rubocop-0.4.1 lib/rubocop/cop/class_and_module_camel_case.rb
rubocop-0.4.0 lib/rubocop/cop/class_and_module_camel_case.rb
rubocop-0.3.2 lib/rubocop/cop/class_and_module_camel_case.rb