Class: HamlLint::Linter::NoPlaceholders

Inherits:
HamlLint::Linter 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 Attribute Summary

Attributes inherited from HamlLint::Linter

#lints

Instance Method Summary collapse

Methods included from HamlLint::LinterRegistry

extract_linters_from, included

Methods inherited from HamlLint::Linter

#initialize, #name, #run, #run_or_raise, supports_autocorrect?, #supports_autocorrect?

Methods included from HamlVisitor

#visit, #visit_children

Constructor Details

This class inherits a constructor from HamlLint::Linter

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