Sha256: 242fc6127e9480981c3dbfa7b3b90fb88f5fa1ea716d8afcc49e60745f2a3982
Contents?: true
Size: 542 Bytes
Versions: 9
Compression:
Stored size: 542 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] next if comment =~ /^\s*rubocop:\w+/ report_lint(sexp, "Slim code comments (`/#{comment}`) are preferred over " \ "control statement comments (`-##{comment}`)") end end end
Version data entries
9 entries across 9 versions & 1 rubygems