Class: Rubocop::Cop::Style::Tab
Overview
This cop checks for tabs inside the source code.
Constant Summary collapse
- MSG =
'Tab detected.'
Constants inherited from Cop
Instance Attribute Summary
Attributes inherited from Cop
#config, #corrections, #offences, #processed_source
Instance Method Summary collapse
Methods inherited from Cop
#add_offence, all, #autocorrect?, #convention, #cop_config, cop_name, #cop_name, cop_type, #debug?, #ignore_node, inherited, #initialize, lint?, #message, non_rails, rails?, style?, #support_autocorrect?, #warning
Constructor Details
This class inherits a constructor from Rubocop::Cop::Cop
Instance Method Details
#investigate(processed_source) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rubocop/cop/style/tab.rb', line 10 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, 1), MSG) end end end |