Sha256: 93fa048d97e78006a04ddbac3558ea1a9bc3b95998532c7ff38b906d599e0421

Contents?: true

Size: 736 Bytes

Versions: 10

Compression:

Stored size: 736 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.raw_source.each_line.with_index do |line, index|
            next unless line =~ /\r$/

            range =
              source_range(processed_source.buffer, index + 1, 0, line.length)
            add_offense(nil, range, MSG)
            # Usually there will be carriage return characters on all or none
            # of the lines in a file, so we report only one offense.
            break
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
rubyjobbuilderdsl-0.0.2 vendor/bundle/ruby/2.1.0/gems/rubocop-0.26.0/lib/rubocop/cop/style/end_of_line.rb
rubyjobbuilderdsl-0.0.1 vendor/bundle/ruby/2.1.0/gems/rubocop-0.26.0/lib/rubocop/cop/style/end_of_line.rb
rubocop-0.29.1 lib/rubocop/cop/style/end_of_line.rb
rubocop-0.29.0 lib/rubocop/cop/style/end_of_line.rb
rubocop-0.28.0 lib/rubocop/cop/style/end_of_line.rb
rubocop-0.27.1 lib/rubocop/cop/style/end_of_line.rb
rubocop-0.27.0 lib/rubocop/cop/style/end_of_line.rb
rubocop-0.26.1 lib/rubocop/cop/style/end_of_line.rb
rubocop-0.26.0 lib/rubocop/cop/style/end_of_line.rb
rubocop-0.25.0 lib/rubocop/cop/style/end_of_line.rb