Sha256: a3e53e8008838029b4b26e7d80b3950ff7d5d47d0f643cc9305f0a6e50cf602b

Contents?: true

Size: 763 Bytes

Versions: 4

Compression:

Stored size: 763 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]+$/
              add_offence(:convention,
                          source_range(processed_source.buffer,
                                       processed_source[0...index],
                                       line.rstrip.length,
                                       line.length - line.rstrip.length),
                          MSG)
            end
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubocop-0.12.0 lib/rubocop/cop/style/trailing_whitespace.rb
rubocop-0.11.1 lib/rubocop/cop/style/trailing_whitespace.rb
rubocop-0.11.0 lib/rubocop/cop/style/trailing_whitespace.rb
rubocop-0.10.0 lib/rubocop/cop/style/trailing_whitespace.rb