Ensure that we populate information about waiver expiration regardless of

Signed-off-by: Nick Schwaderer <nschwaderer@chef.io>
This commit is contained in:
Nick Schwaderer 2020-10-13 10:11:40 +01:00
parent 38971c7122
commit 459ffcdd2f

View file

@ -343,14 +343,8 @@ module Inspec
__waiver_data["skipped_due_to_waiver"] = false
__waiver_data["message"] = ""
# Waivers should have a hash value with keys possibly including "run" and
# expiration_date. We only care here if it has a "run" key and it
# is false-like, since all non-skipped waiver operations are handled
# during reporting phase.
return unless __waiver_data.key?("run") && !__waiver_data["run"]
# OK, the intent is to skip. Does it have an expiration date, and
# if so, is it in the future?
# Does it have an expiration date, and if so, is it in the future?
# This sets a waiver message before checking `run: true`
expiry = __waiver_data["expiration_date"]
if expiry
# YAML will automagically give us a Date or a Time.
@ -370,6 +364,12 @@ module Inspec
end
end
# Waivers should have a hash value with keys possibly including "run" and
# expiration_date. We only care here if it has a "run" key and it
# is false-like, since all non-skipped waiver operations are handled
# during reporting phase.
return unless __waiver_data.key?("run") && !__waiver_data["run"]
# OK, apply a skip.
@__skip_rule[:result] = true
@__skip_rule[:type] = :waiver