class HamlLint::Linter::LineLength

Checks for lines longer than a maximum number of columns.

Constants

DummyNode

A marker for a line within a multiline node.

@api private

MSG

Public Instance Methods

visit_root(root) click to toggle source
# 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