Sha256: 94ee56a3b4aa08ca404cb03362634b38bd5dcf44c99e9cc4e7545ce5a278513f

Contents?: true

Size: 665 Bytes

Versions: 3

Compression:

Stored size: 665 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 inspect(source_buffer, source, tokens, ast, comments)
          source.each_with_index do |line, index|
            match = line.match(/^( *)\t/)
            if match
              spaces = match.captures[0]
              add_offence(:convention,
                          source_range(source_buffer, source[0...index],
                                       spaces.length, 8),
                          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/tab.rb
sabat-rubocop-0.9.0 lib/rubocop/cop/style/tab.rb
rubocop-0.9.0 lib/rubocop/cop/style/tab.rb