Skip to main content

GateOutcome

Struct GateOutcome 

Source
pub struct GateOutcome {
    pub status: GateStatus,
    pub enforced: bool,
    pub observed: Option<f64>,
    pub threshold: Option<f64>,
    pub threshold_label: Option<String>,
    pub files: Vec<GateFile>,
}
Expand description

One gate’s verdict on one run.

status and enforced answer different questions and legitimately disagree. status is what the rule concluded; enforced is whether a fail from this gate would make the run exit non-zero. A health --report-only run is an explicit request never to fail, so a failing gate there reports status: fail with enforced: false, and a stale-baseline verdict published without --fail-on-stale-baseline reports the same pair.

A gate fails the build when status is fail AND enforced is true. Neither member decides it alone: enforced is true on every armed gate, including the ones that passed, so gating on it by itself fails every run that armed anything. Read status on its own to decide what to say, and remember that warn and skipped are neither a pass nor a failure.

Fields§

§status: GateStatus

What the rule concluded.

§enforced: bool

True when a fail from this gate makes the run exit non-zero. False when the verdict is published for information only: the gate was never armed, the run was told never to fail, or the combined machine formats exit 0 for the gate.

§observed: Option<f64>

The measured value the gate compared, when there is one: the duplication percentage, the health score, the number of findings at or above the severity floor, or the number of files in files. Whole numbers are carried as JSON numbers, so a count of three reads as 3.0. Absent for gates that compare no number.

§threshold: Option<f64>

The configured limit observed was compared against, when there is one. Absent for gates that compare no number.

§threshold_label: Option<String>

How the limit was spelled, for a gate whose threshold number does not carry its own unit. health-min-severity sets it to the severity floor (moderate, high or critical); regression sets it to the tolerance as the user wrote it ("50%" or "5"), because threshold there is the allowance in issues and the percentage would otherwise be unrecoverable on the grouped envelope, which carries no regression object. Absent for gates whose numbers speak for themselves.

§files: Vec<GateFile>

The files the gate judged, for a gate that judges files rather than a number. Only parse-error sets it: one item per file that did not parse cleanly, sorted by path. Absent when the list is empty.

Implementations§

Source§

impl GateOutcome

Source

pub const fn new(status: GateStatus, enforced: bool) -> Self

A gate that ran, compared no number, and was armed.

Source

pub const fn measured( status: GateStatus, enforced: bool, observed: f64, threshold: f64, ) -> Self

A gate that compared observed against threshold.

Source

pub fn counted( status: GateStatus, enforced: bool, observed: f64, threshold_label: &str, ) -> Self

A gate that counted observed items at or above a named floor.

Source

pub fn with_files( status: GateStatus, enforced: bool, files: Vec<GateFile>, ) -> Self

A gate that judged files: observed is the number of files it named.

Source

pub const fn fails_run(&self) -> bool

Whether this outcome should make the run exit non-zero.

Trait Implementations§

Source§

impl Clone for GateOutcome

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GateOutcome

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for GateOutcome

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for GateOutcome

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for GateOutcome

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<'a, T> FromIn<'a, T> for T

Source§

fn from_in(t: T, _: &'a Allocator) -> T

Converts to this type from the input type within the given allocator.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<'a, T, U> IntoIn<'a, U> for T
where U: FromIn<'a, T>,

Source§

fn into_in(self, allocator: &'a Allocator) -> U

Converts this type into the (usually inferred) input type within the given allocator.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more