Sha256: a34e350f4d38d70565644e4aee2b98fbacd0769daea8e3d80da642445f964001

Contents?: true

Size: 708 Bytes

Versions: 5

Compression:

Stored size: 708 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_offense(nil,
                          source_range(processed_source.buffer,
                                       processed_source[0...index],
                                       spaces.length, 1),
                          MSG)
            end
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubocop-0.21.0 lib/rubocop/cop/style/tab.rb
rubocop-0.20.1 lib/rubocop/cop/style/tab.rb
rubocop-0.20.0 lib/rubocop/cop/style/tab.rb
rubocop-0.19.1 lib/rubocop/cop/style/tab.rb
rubocop-0.19.0 lib/rubocop/cop/style/tab.rb