Class: HamlLint::Linter::TagName

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

Overview

Checks for tag names with uppercase letters.

Instance Method Summary collapse

Methods included from HamlLint::LinterRegistry

extract_linters_from, included

Instance Method Details

#visit_tag(node) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/haml_lint/linter/tag_name.rb', line 10

def visit_tag(node)
  tag = node.tag_name
  return unless /[A-Z]/.match?(tag)

  corrected = correct_tag_name(node, tag)
  record_lint(node, "`#{tag}` should be written in lowercase as `#{tag.downcase}`",
              corrected: corrected)
end