Sha256: d4285e03357a07399a7734e79bc44c8ea058e51af8d7ac3c61510342e95f547d

Contents?: true

Size: 641 Bytes

Versions: 3

Compression:

Stored size: 641 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/)
            next unless match

            spaces = match.captures[0]

            range = source_range(processed_source.buffer,
                                 index + 1,
                                 spaces.length)

            add_offense(nil, range, MSG)
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubocop-0.25.0 lib/rubocop/cop/style/tab.rb
rubocop-0.24.1 lib/rubocop/cop/style/tab.rb
rubocop-0.24.0 lib/rubocop/cop/style/tab.rb