Sha256: 699a3f6832eaf1cba74a2045d0eedc7e9e6d9d4dbafe6e48ff8d27aed3876b46
Contents?: true
Size: 730 Bytes
Versions: 9
Compression:
Stored size: 730 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| next unless line =~ /.*[ \t]+$/ range = source_range(processed_source.buffer, index + 1, (line.rstrip.length)...(line.length)) add_offense(range, range) end end def autocorrect(range) ->(corrector) { corrector.remove(range) } end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems