class HamlLint::Linter::SpaceInsideHashAttributes

Checks for spaces inside the braces of hash attributes (e.g. `%tag{ lang: en }` vs `%tag{lang: en}`).

Constants

STYLE

Public Instance Methods

visit_tag(node) click to toggle source
# File lib/haml_lint/linter/space_inside_hash_attributes.rb, line 24
def visit_tag(node)
  return unless node.hash_attributes?

  style = STYLE[config['style'] == 'no_space' ? 'no_space' : 'space']
  source = node.hash_attributes_source

  record_lint(node, style[:start_message]) unless source =~ style[:start_regex]
  record_lint(node, style[:end_message]) unless source =~ style[:end_regex]
end