Class: HamlLint::Linter::Indentation
- Inherits:
-
HamlLint::Linter
- Object
- HamlLint::Linter
- HamlLint::Linter::Indentation
- Includes:
- HamlLint::LinterRegistry
- Defined in:
- lib/haml_lint/linter/indentation.rb
Overview
Checks the character used for indentation.
Constant Summary collapse
- INDENT_REGEX =
Allowed leading indentation for each character type.
{ space: /^[ ]*(?!\t)/, tab: /^\t*(?![ ])/, }.freeze
Instance Attribute Summary
Attributes inherited from HamlLint::Linter
Instance Method Summary collapse
Methods included from HamlLint::LinterRegistry
extract_linters_from, included
Methods inherited from HamlLint::Linter
Methods included from HamlVisitor
Constructor Details
This class inherits a constructor from HamlLint::Linter
Instance Method Details
#visit_root(_node) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/haml_lint/linter/indentation.rb', line 12 def visit_root(_node) regex = INDENT_REGEX[config['character'].to_sym] dummy_node = Struct.new(:line) document.source_lines.each_with_index do |line, index| next if line =~ regex record_lint dummy_node.new(index + 1), 'Line contains tabs in indentation' end end |