Class: Rubocop::Cop::ClassAndModuleCamelCase
- Defined in:
- lib/rubocop/cop/class_and_module_camel_case.rb
Constant Summary collapse
- ERROR_MESSAGE =
'Use CamelCase for classes and modules.'
Instance Attribute Summary
Attributes inherited from Cop
#correlations, #debug, #disabled_lines, #offences
Instance Method Summary collapse
Methods inherited from Cop
#add_offence, cop_name, #has_report?, inherited, #initialize, #name
Constructor Details
This class inherits a constructor from Rubocop::Cop::Cop
Instance Method Details
#inspect(file, source, tokens, sexp) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/rubocop/cop/class_and_module_camel_case.rb', line 8 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 |