Class: HamlLint::Linter::LeadingCommentSpace
- Inherits:
-
HamlLint::Linter
- Object
- HamlLint::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 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
autocorrect_priority, autocorrect_safe?, #initialize, #name, ruby_parser, #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_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 |