Class: HamlLint::Linter::AlignmentTabs

Inherits:
Linter
  • Object
show all
Includes:
HamlLint::LinterRegistry
Defined in:
lib/haml_lint/linter/alignment_tabs.rb

Overview

Checks for tabs that are placed for alignment of tag content

Constant Summary collapse

REGEX =
/[^\s*]\t+/
CORRECTION_REGEX =

Same as REGEX, but captures the character preceding the alignment tabs so it can be kept while the tabs themselves are collapsed to a space.

/([^\s*])\t+/

Instance Method Summary collapse

Methods included from HamlLint::LinterRegistry

extract_linters_from, included

Instance Method Details

#visit_tag(node) ⇒ Object



16
17
18
19
20
# File 'lib/haml_lint/linter/alignment_tabs.rb', line 16

def visit_tag(node)
  return unless REGEX.match?(node.source_code)

  record_lint(node, 'Avoid using tabs for alignment', corrected: correct(node))
end