pub struct GateOutcomes(/* private fields */);Expand description
The verdict of every gate a run evaluated, keyed by name.
A gate is armed by a flag or by config. The default exit rule of a command
is always in the object, also when no flag armed a gate:
error-severity-findings on dead-code, check and the combined run
(with health-findings when the combined run analyzed health),
health-findings on health, security-advisory on security and
audit-verdict on audit. A reader of the JSON sees a failing run without
the exit code. dupes has no default exit rule, so a dupes run that armed
no gate carries no object and always exits 0.
An empty object is never emitted. The typed programmatic API runs no CLI gate and leaves the object absent.
The names this build can emit are error-severity-findings, regression,
stale-baseline, duplication-threshold, health-min-score,
health-min-severity, health-findings, health-coverage-gaps,
health-runtime-coverage, security, security-advisory, audit-verdict,
type-aware-require and parse-error. The set is OPEN: a name a consumer does not
recognise means “some gate”, not an error.
Implementations§
Source§impl GateOutcomes
impl GateOutcomes
Sourcepub fn new() -> Self
pub fn new() -> Self
An empty set, which serializes to nothing once Self::into_option
has been applied.
Sourcepub fn insert(&mut self, name: GateName, outcome: GateOutcome)
pub fn insert(&mut self, name: GateName, outcome: GateOutcome)
Record one gate’s outcome, replacing any previous entry for that name.
Sourcepub fn insert_if(&mut self, name: GateName, outcome: Option<GateOutcome>)
pub fn insert_if(&mut self, name: GateName, outcome: Option<GateOutcome>)
Record one gate’s outcome when it ran at all.
Sourcepub fn get(&self, name: GateName) -> Option<&GateOutcome>
pub fn get(&self, name: GateName) -> Option<&GateOutcome>
Read one gate’s outcome.
Sourcepub fn fails_run(&self) -> bool
pub fn fails_run(&self) -> bool
Whether a gate of the set fails the run: its status is fail and it
is enforced.
Sourcepub fn into_option(self) -> Option<Self>
pub fn into_option(self) -> Option<Self>
Collapse an empty set to None, which is how the field stays absent on
a run that evaluated no gate.