Sha256: df799a9487a9abce7ea8e0d1a4daa866d138a07039befc89ce765c2daadcf4fa

Contents?: true

Size: 703 Bytes

Versions: 2

Compression:

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubocop-0.13.1 lib/rubocop/cop/style/tab.rb
rubocop-0.13.0 lib/rubocop/cop/style/tab.rb