class Rubocop::Cop::Style::Tab

This cop checks for tabs inside the source code.

Constants

MSG

Public Instance Methods

inspect(source_buffer, source, tokens, ast, comments) click to toggle source
# File lib/rubocop/cop/style/tab.rb, line 10
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