Class: Rubocop::Cop::Style::EndOfLine
- Defined in:
- lib/rubocop/cop/style/end_of_line.rb
Overview
This cop checks for Windows-style line endings in the source code.
Constant Summary collapse
- MSG =
'Carriage return character detected.'
Instance Attribute Summary
Attributes inherited from Cop
#autocorrect, #corrections, #debug, #disabled_lines, #offences
Instance Method Summary collapse
Methods inherited from Cop
#add_offence, all, #autocorrect_action, cop_name, cop_type, #do_autocorrect, #ignore_node, inherited, #initialize, lint?, #name, rails?, style?
Constructor Details
This class inherits a constructor from Rubocop::Cop::Cop
Instance Method Details
#investigate(processed_source) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rubocop/cop/style/end_of_line.rb', line 10 def investigate(processed_source) processed_source.lines.each_with_index do |line, index| if line =~ /\r$/ add_offence(:convention, source_range(processed_source.buffer, processed_source[0...index], line.length - 1, 1), MSG) end end end |