sds/haml-lint

View on GitHub
lib/haml_lint/linter/html_attributes.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

module HamlLint
  # Checks for the setting of attributes via HTML shorthand syntax on elements
  # (e.g. `%tag(lang=en)`).
  class Linter::HtmlAttributes < Linter
    include LinterRegistry

    def visit_tag(node)
      return unless node.html_attributes?

      record_lint(node, "Prefer the hash attributes syntax (%tag{ lang: 'en' }) " \
                        'over HTML attributes syntax (%tag(lang=en))')
    end
  end
end