Class: HamlLint::Linter::HtmlAttributes

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

Overview

Checks for the setting of attributes via HTML shorthand syntax on elements (e.g. ‘%tag(lang=en)`).

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



9
10
11
12
13
14
# File 'lib/haml_lint/linter/html_attributes.rb', line 9

def visit_tag(node)
  return unless node.html_attributes?

  record_lint(node, "Prefer the hash attributes syntax (%tag{ lang: 'en' }) " \
                    'over HTML attributes syntax (%tag(lang=en))')
end