Class: HamlLint::Linter::ViewLength
- Inherits:
-
HamlLint::Linter
- Object
- HamlLint::Linter
- HamlLint::Linter::ViewLength
- Includes:
- HamlLint::LinterRegistry
- Defined in:
- lib/haml_lint/linter/view_length.rb
Overview
Detects overly long views.
Defined Under Namespace
Classes: DummyNode
Constant Summary collapse
- MSG =
'View template is too long [%d/%d]'
Instance Attribute Summary
Attributes inherited from HamlLint::Linter
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
Constructor Details
This class inherits a constructor from HamlLint::Linter
Instance Method Details
#visit_root(root) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/haml_lint/linter/view_length.rb', line 12 def visit_root(root) max = config['max'] line_count = document.last_non_empty_line node = root.children.first if line_count > max && !node.disabled?(self) record_lint(DummyNode.new(0), format(MSG, line_count, max)) end end |