Class: HamlLint::Linter::LineLength
- Inherits:
-
HamlLint::Linter
- Object
- HamlLint::Linter
- HamlLint::Linter::LineLength
- Includes:
- HamlLint::LinterRegistry
- Defined in:
- lib/haml_lint/linter/line_length.rb
Overview
Checks for lines longer than a maximum number of columns.
Defined Under Namespace
Classes: DummyNode
Constant Summary collapse
- MSG =
'Line 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
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/haml_lint/linter/line_length.rb', line 15 def visit_root(root) max_length = config['max'] document.source_lines.each_with_index do |line, index| next if line.length <= max_length node = root.node_for_line(index + 1) unless node.disabled?(self) record_lint(DummyNode.new(index + 1), format(MSG, line.length, max_length)) end end end |