Sha256: da6e4e9483a1677592e55aca7061baebc3fa141ea6e07444cf8e0eff8caf86c5

Contents?: true

Size: 498 Bytes

Versions: 3

Compression:

Stored size: 498 Bytes

Contents

# frozen_string_literal: true

module SlimLint
  # Searches for control statements with only comments.
  class Linter::CommentControlStatement < Linter
    include LinterRegistry

    on [:slim, :control] do |sexp|
      _, _, code = sexp
      next unless code[/\A\s*#/]

      comment = code[/\A\s*#(.*\z)/, 1]

      report_lint(sexp,
                  "Slim code comments (`/#{comment}`) are preferred over " \
                  "control statement comments (`-##{comment}`)")
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
slim_lint-0.17.0 lib/slim_lint/linter/comment_control_statement.rb
slim_lint-0.16.1 lib/slim_lint/linter/comment_control_statement.rb
slim_lint-0.16.0 lib/slim_lint/linter/comment_control_statement.rb