Class: HamlLint::Linter::NoPlaceholders

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

Overview

Checks that placeholder attributes are not used.

Constant Summary collapse

MSG =
'Placeholders attributes should not be used.'
HASH_REGEXP =
/:?['"]?placeholder['"]?(?::| *=>)/
HTML_REGEXP =
/placeholder=/

Instance Method Summary collapse

Methods included from HamlLint::LinterRegistry

extract_linters_from, included

Instance Method Details

#visit_tag(node) ⇒ Object



12
13
14
15
16
# File 'lib/haml_lint/linter/no_placeholders.rb', line 12

def visit_tag(node)
  return unless node.hash_attributes_source =~ HASH_REGEXP || node.html_attributes_source =~ HTML_REGEXP

  record_lint(node, MSG)
end