Class: HamlLint::Linter::LeadingCommentSpace
- Inherits:
-
Linter
- Object
- Linter
- HamlLint::Linter::LeadingCommentSpace
- Includes:
- HamlLint::LinterRegistry
- Defined in:
- lib/haml_lint/linter/leading_comment_space.rb
Overview
Checks for comments that don't have a leading space.
Instance Method Summary collapse
Methods included from HamlLint::LinterRegistry
extract_linters_from, included
Instance Method Details
#visit_haml_comment(node) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/haml_lint/linter/leading_comment_space.rb', line 10 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) corrected = correct_leading_space(node) record_lint(node, 'Comment should have a space after the `#`', corrected: corrected) end |