Sha256: b4bc7fa2ad365683a9eef6724f3de223b55a4546c59cda42f903bed4002fa51a

Contents?: true

Size: 719 Bytes

Versions: 4

Compression:

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubocop-0.14.1 lib/rubocop/cop/style/trailing_whitespace.rb
rubocop-0.14.0 lib/rubocop/cop/style/trailing_whitespace.rb
rubocop-0.13.1 lib/rubocop/cop/style/trailing_whitespace.rb
rubocop-0.13.0 lib/rubocop/cop/style/trailing_whitespace.rb