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 they can disagree.
status is what the rule concluded. enforced tells if a fail from this
gate makes the run exit non-zero. A run that was told never to fail reports
a failed gate as status: fail with enforced: false.
A gate fails the build when status is fail and enforced is true.
One member alone does not decide it. enforced is true on every armed
gate, also on a gate that passed. Thus a gate rule on enforced alone
fails every run that armed a gate. Read status alone to decide what to
say. warn and skipped are not a pass and not a failure.
Fields§
§status: GateStatusWhat the rule concluded.
enforced: boolTrue when a fail from this gate makes the run exit non-zero. False
when the tool publishes the verdict for information only: no flag or
config armed the gate, the run was told never to fail, or the output
format exits 0 for the gate.
observed: Option<f64>The measured value that the gate compared, when there is one: for
example a percentage, a score, a number of findings, or the number of
files in files. A whole number is a JSON number, so a count of three
reads as 3.0. Absent for a gate that compares no number.
threshold: Option<f64>The configured limit that the gate compared observed against, when
there is one. Absent for a gate that compares no number.
threshold_label: Option<String>How the limit was spelled, for a gate whose threshold number does not
carry its unit. Examples are a severity floor such as high, the rule
severity that the gate counts such as error, or a tolerance as the
user wrote it, such as "50%". Each gate name documents its label.
Absent for a gate whose numbers have a clear meaning without a label.
files: Vec<GateFile>The files that the gate judged, for a gate that judges files and not a number. One item for each file, sorted by path. Absent when the list is empty.
Implementations§
Source§impl GateOutcome
impl GateOutcome
Sourcepub const fn new(status: GateStatus, enforced: bool) -> Self
pub const fn new(status: GateStatus, enforced: bool) -> Self
A gate that ran, compared no number, and was armed.
Sourcepub const fn measured(
status: GateStatus,
enforced: bool,
observed: f64,
threshold: f64,
) -> Self
pub const fn measured( status: GateStatus, enforced: bool, observed: f64, threshold: f64, ) -> Self
A gate that compared observed against threshold.
Sourcepub fn counted(
status: GateStatus,
enforced: bool,
observed: f64,
threshold_label: &str,
) -> Self
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.
Sourcepub fn with_files(
status: GateStatus,
enforced: bool,
files: Vec<GateFile>,
) -> Self
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.