Sha256: 2458f592e30ff624279cc51469cd61a5f21d6e1234c5c584f3ec95ef553c757f

Contents?: true

Size: 689 Bytes

Versions: 4

Compression:

Stored size: 689 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    module Style
      # This cop checks for Windows-style line endings in the source code.
      class EndOfLine < Cop
        MSG = 'Carriage return character detected.'

        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
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubocop-0.12.0 lib/rubocop/cop/style/end_of_line.rb
rubocop-0.11.1 lib/rubocop/cop/style/end_of_line.rb
rubocop-0.11.0 lib/rubocop/cop/style/end_of_line.rb
rubocop-0.10.0 lib/rubocop/cop/style/end_of_line.rb