Sha256: b1ea015c49441b694752cb57ea74aca071cbae52e084e33526a76072b17dfde8
Contents?: true
Size: 1.02 KB
Versions: 25
Compression:
Stored size: 1.02 KB
Contents
# frozen_string_literal: true module PlatformosCheck class MissingEnableComment < LiquidCheck severity :error doc docs_url(__FILE__) # Don't allow this check to be disabled with a comment, # as we need to be able to check for disabled checks. can_disable false def on_document(_node) @disabled_checks = DisabledChecks.new end def on_comment(node) @disabled_checks.update(node) end def on_inline_comment(node) @disabled_checks.update(node) end def after_document(node) checks_missing_end_index = @disabled_checks.checks_missing_end_index return if checks_missing_end_index.empty? message = if checks_missing_end_index.any? { |name| name == :all } "All checks were" else checks_missing_end_index.join(', ') + " " + (checks_missing_end_index.size == 1 ? "was" : "were") end add_offense("#{message} disabled but not re-enabled with platformos-check-enable", node:) end end end
Version data entries
25 entries across 25 versions & 1 rubygems