Sha256: 6e8b1f412b1f71d18dd8a3a25555e0d777a868a1f798d14ff3e16c182bc4e2ad

Contents?: true

Size: 712 Bytes

Versions: 3

Compression:

Stored size: 712 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 inspect(source_buffer, source, tokens, ast, comments)
          source.each_with_index do |line, index|
            if line =~ /.*[ \t]+$/
              add_offence(:convention,
                          source_range(source_buffer, source[0...index],
                                       line.rstrip.length,
                                       line.length - line.rstrip.length),
                          MSG)
            end
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
rubocop-0.9.1 lib/rubocop/cop/style/trailing_whitespace.rb
sabat-rubocop-0.9.0 lib/rubocop/cop/style/trailing_whitespace.rb
rubocop-0.9.0 lib/rubocop/cop/style/trailing_whitespace.rb