class HamlLint::Linter::LeadingCommentSpace

Checks for comments that don’t have a leading space.

Public Instance Methods

visit_haml_comment(node) click to toggle source
# File lib/haml_lint/linter/leading_comment_space.rb, line 8
def visit_haml_comment(node)
  # Skip if the node spans multiple lines starting on the second line,
  # or starts with a space
  return if /\A#*(\s*|\s+\S.*)$/.match?(node.text)

  record_lint(node, 'Comment should have a space after the `#`')
end