Sha256: 04ce2e2c405ee9d170f35f9fd1e3a75014a1b981e61a1b26376cc7835f2281fa
Contents?: true
Size: 828 Bytes
Versions: 5
Compression:
Stored size: 828 Bytes
Contents
# encoding: utf-8 module Rubocop module Cop module Style # This cop looks for trailing whitespace in the source code. class TrailingWhitespace < Cop MSG = 'Trailing whitespace detected.' def investigate(processed_source) processed_source.lines.each_with_index do |line, index| if line =~ /.*[ \t]+$/ range = source_range(processed_source.buffer, processed_source[0...index], line.rstrip.length, line.length - line.rstrip.length) add_offense(range, range) end end end def autocorrect(range) @corrections << ->(corrector) { corrector.remove(range) } end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems