Class: Rubocop::Cop::EndOfLine

Inherits:
Cop
  • Object
show all
Defined in:
lib/rubocop/cop/end_of_line.rb

Constant Summary collapse

MSG =
'Carriage return character detected.'

Instance Attribute Summary

Attributes inherited from Cop

#debug, #disabled_lines, #offences

Instance Method Summary collapse

Methods inherited from Cop

#add_offence, cop_name, #has_report?, #ignore_node, inherited, #initialize, #name, #on_comment

Constructor Details

This class inherits a constructor from Rubocop::Cop::Cop

Instance Method Details

#inspect(source, tokens, ast, comments) ⇒ Object



8
9
10
11
12
# File 'lib/rubocop/cop/end_of_line.rb', line 8

def inspect(source, tokens, ast, comments)
  source.each_with_index do |line, index|
    add_offence(:convention, index + 1, MSG) if line =~ /\r$/
  end
end