Parent

Files

Class/Module Index [+]

Quicksearch

RuboCop::Cop::Style::TrailingWhitespace

This cop looks for trailing whitespace in the source code.

Constants

MSG

Public Instance Methods

autocorrect(range) click to toggle source
# File lib/rubocop/cop/style/trailing_whitespace.rb, line 20
def autocorrect(range)
  @corrections << ->(corrector) { corrector.remove(range) }
end
investigate(processed_source) click to toggle source
# 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

[Validate]

Generated with the Darkfish Rdoc Generator 2.