This cop looks for trailing whitespace in the source code.
# File lib/rubocop/cop/style/trailing_whitespace.rb, line 20 def autocorrect(range) @corrections << ->(corrector) { corrector.remove(range) } end
# File lib/rubocop/cop/style/trailing_whitespace.rb, line 9 def investigate(processed_source) processed_source.lines.each_with_index do |line, index| next unless 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
Generated with the Darkfish Rdoc Generator 2.