Skip to main content

RequestOutcome

Struct RequestOutcome 

Source
pub struct RequestOutcome {
    pub status: RequestStatus,
    pub affects: RequestEffect,
    pub requested: String,
    pub scope_size: Option<u64>,
    pub reason: Option<String>,
    pub message: Option<String>,
}
Expand description

One request’s fate on one run.

reason and message are present exactly when status is not applied, and absent otherwise, so a consumer that only wants to know whether a report is scoped reads status alone.

Fields§

§status: RequestStatus

What became of the request.

§affects: RequestEffect

What this request governs, and therefore what an unapplied one means. Derived from the name, so the two can never disagree.

§requested: String

What was asked, as the user spelled it: the git ref for changed-since, the diff source label (--diff-file pr.diff, --diff-stdin, $FALLOW_DIFF_FILE build/pr.diff, or diffFile pr.diff for the programmatic option) for diff-filter, workspaces.changedSince for package-baselines, the target path for sarif-file. Echoed rather than normalised, so a consumer must not join it to the project root the way it joins every other path-shaped field.

§scope_size: Option<u64>

How much this request left in scope, in the request’s own unit, when the run applied it AND measured that scope. Absent otherwise, including on every unapplied entry: a request that stood down narrowed nothing, so a number there would describe a scope nobody applied.

The unit belongs to the name. diff-filter counts added lines, which is what its filter keeps a finding for. changed-since counts changed files that the run analyzed: a changed file that discovery or an ignore rule dropped does not count, so a change to a README only gives 0. A combined run counts a file that any of its analyses kept, because a per-analysis production setting can give its analyses different files. Read the unit off the name the entry is keyed under, never across names, and read an absent member as “not measured” rather than as zero.

The count is what the run INDEXED rather than the true total: diff-filter indexes at most one million added lines and reports that cap for a larger diff, so read any non-zero value as a lower bound.

0 is the case this member exists for: a request that applied over an EMPTY scope. Every finding then filters out and the report reads clean, so a consumer that sees no findings beside scope_size: 0 learns that nothing was analyzable rather than that the code is clean.

§reason: Option<String>

Why the request was not applied, as a kebab-case token. Present exactly when status is not applied. The set is open per request name; the names this build can emit are listed on RequestOutcomes.

§message: Option<String>

One sentence naming what was asked, what happened instead, and the next step. Byte-identical to the stderr line for the same case, so a consumer that renders this never contradicts a log a human read. Present exactly when status is not applied.

Implementations§

Source§

impl RequestOutcome

Source

pub fn applied(name: RequestName, requested: impl Into<String>) -> Self

A request the run honoured.

Takes the name rather than the class so no caller can file a request under the wrong one.

Source

pub fn applied_with_scope_size( name: RequestName, requested: impl Into<String>, size: u64, ) -> Self

A request the run honoured, whose remaining scope it also measured.

size is in the unit RequestOutcome::scope_size documents for this name. Use Self::applied where the run applies a request without measuring what it left, so the member stays absent rather than claiming a zero nobody counted.

Source

pub fn not_applied( name: RequestName, requested: impl Into<String>, reason: impl Into<String>, message: impl Into<String>, ) -> Self

A request the run could not honour, with the reason token and the sentence the CLI also wrote to stderr.

Trait Implementations§

Source§

impl Clone for RequestOutcome

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 RequestOutcome

Source§

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

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

impl Eq for RequestOutcome

Source§

impl PartialEq for RequestOutcome

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 RequestOutcome

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 RequestOutcome

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
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