Class: Rubocop::Cop::EndOfLine
- Defined in:
- lib/rubocop/cop/end_of_line.rb
Constant Summary collapse
- ERROR_MESSAGE =
'Carriage return character detected.'
Instance Attribute Summary
Attributes inherited from Cop
Instance Method Summary collapse
Methods inherited from Cop
#add_offence, enabled?, #has_report?, inherited, #initialize
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 |
# File 'lib/rubocop/cop/end_of_line.rb', line 8 def inspect(file, source, tokens, sexp) source.each_with_index do |line, index| if line =~ /\r$/ add_offence(:convention, index + 1, ERROR_MESSAGE) end end end |