class HamlLint::Linter::ClassAttributeWithStaticValue

%tag{ class: ‘{{ template-var }}’ }
But will allow invalid class names for templating:
%tag{ class: ‘class-name’ }
…over:
%tag.class-name
For example, it will prefer this:
values.
Checks for class attributes defined in tag attribute hash with static

def contains_class_attribute?(attributes_sources)

def contains_class_attribute?(attributes_sources)
  attributes_sources.each do |code|
    ast_root = parse_ruby(surrounded_by_braces?(code) ? code : "{#{code}}")
    next unless ast_root # RuboCop linter will report syntax errors
    ast_root.children.each do |pair|
      return true if static_class_attribute_value?(pair)
    end
  end
  false
end

def static_class_attribute_value?(pair)

def static_class_attribute_value?(pair)
  return false if (children = pair.children).empty?
  key, value = children
  STATIC_TYPES.include?(key.type) &&
    key.children.first.to_sym == :class &&
    STATIC_TYPES.include?(value.type) &&
    value.children.first =~ VALID_CLASS_REGEX
end

def surrounded_by_braces?(code)

def surrounded_by_braces?(code)
  code.start_with?('{') && code.end_with?('}')
end

def visit_tag(node)

def visit_tag(node)
  return unless contains_class_attribute?(node.dynamic_attributes_sources)
  record_lint(node, 'Avoid defining `class` in attributes hash ' \
                    'for static class names')
end