Sha256: 107bb6e0fa1ffb0c1fc5ccca66629c19591dc225945d4895db130616b3662ed2
Contents?: true
Size: 992 Bytes
Versions: 5
Compression:
Stored size: 992 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) buffer = processed_source.buffer original_source = IO.read(buffer.name, encoding: buffer.source.encoding) original_source.lines.each_with_index do |line, index| if line =~ /\r$/ add_offense(nil, source_range(buffer, processed_source[0...index], 0, line.length), 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 end
Version data entries
5 entries across 5 versions & 1 rubygems