Class: HamlLint::Linter::StrictLocals
- Inherits:
-
HamlLint::Linter
- Object
- HamlLint::Linter
- HamlLint::Linter::StrictLocals
- Includes:
- HamlLint::LinterRegistry
- Defined in:
- lib/haml_lint/linter/strict_locals.rb
Overview
Checks for the presence of a ‘locals` magic comment at the beginning of a partial.
Defined Under Namespace
Classes: DummyNode
Instance Attribute Summary
Attributes inherited from HamlLint::Linter
Instance Method Summary collapse
-
#visit_root(root) ⇒ true, false
Enables the linter if the tree is for the right file type.
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
Constructor Details
This class inherits a constructor from HamlLint::Linter
Instance Method Details
#visit_root(root) ⇒ true, false
Enables the linter if the tree is for the right file type.
14 15 16 17 18 19 20 21 22 |
# File 'lib/haml_lint/linter/strict_locals.rb', line 14 def visit_root(root) return unless enabled?(root) first_children = root.children.first return if first_children.is_a?(HamlLint::Tree::HamlCommentNode) && first_children.is_strict_locals? record_lint(DummyNode.new(1), ) end |