Sha256: 03946bbcf2269e47de9e045b1ff567a41720ab7dc101516cfa76ab441847f47c

Contents?: true

Size: 470 Bytes

Versions: 1

Compression:

Stored size: 470 Bytes

Contents

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

1 entries across 1 versions & 1 rubygems

Version Path
slim_lint-0.2.0 lib/slim_lint/linter/comment_control_statement.rb