Sha256: 454322923140e6524ccf2c85f48f8ec7b4e257b7d2ef6b0fc314fa8419e5f720

Contents?: true

Size: 716 Bytes

Versions: 4

Compression:

Stored size: 716 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    module Style
      # This cop checks for tabs inside the source code.
      class Tab < Cop
        MSG = 'Tab detected.'

        def investigate(processed_source)
          processed_source.lines.each_with_index do |line, index|
            match = line.match(/^( *)\t/)
            if match
              spaces = match.captures[0]
              add_offence(:convention,
                          source_range(processed_source.buffer,
                                       processed_source[0...index],
                                       spaces.length, 8),
                          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/tab.rb
rubocop-0.11.1 lib/rubocop/cop/style/tab.rb
rubocop-0.11.0 lib/rubocop/cop/style/tab.rb
rubocop-0.10.0 lib/rubocop/cop/style/tab.rb