pub struct BaselineStaleness {
pub entries: usize,
pub matched: usize,
pub current_findings: usize,
pub change_scoped: bool,
}Expand description
One run’s view of a loaded baseline: everything needed to decide whether the baseline still describes the project.
Every command that accepts --baseline builds one of these and asks it the
same two questions, so dead-code, dupes and health cannot answer
“is this baseline stale enough to say something” three different ways.
Fields§
§entries: usizeEntries saved in the baseline file.
matched: usizeBaseline entries that matched something in this run.
current_findings: usizeFindings this run produced before the baseline filtered them. Zero means there was nothing to compare, either because the project is clean or the scope was empty, so staleness cannot be judged.
change_scoped: boolTrue when this run analyzed only part of the project, so a whole-project baseline matches less of it for reasons that are not rot.
Implementations§
Source§impl BaselineStaleness
impl BaselineStaleness
Sourcepub const fn stale_entries(&self) -> usize
pub const fn stale_entries(&self) -> usize
Entries that matched no current finding on this run.
Sourcepub const fn warning(&self) -> BaselineStalenessWarning
pub const fn warning(&self) -> BaselineStalenessWarning
The advisory warning this run prints on stderr by default.
Silent for a run narrowed to part of the project, because such a run legitimately sees only a slice of a whole-project baseline and re-saving from it would drop every entry the run never looked at. Silent as well when the run produced no findings: a cleaned project and a rotted baseline look identical from here, and the re-save advice is wrong when the right move is deleting the file.
Sourcepub const fn trips_gate(&self) -> bool
pub const fn trips_gate(&self) -> bool
Whether the opt-in --fail-on-stale-baseline gate fires.
Deliberately stricter than Self::warning: any stale entry counts.
The quarter threshold exists to keep an unasked-for line from training
people to ignore it, and the empty-run silence exists because an
advisory cannot tell rot from success; a repository that passes the flag
has asked for both. Change-scope stays the one shared suppression,
because a narrowed run still cannot judge a whole-project baseline.
Sourcepub fn to_envelope(
&self,
moved_entries: usize,
scope_reasons: BaselineScopeReasons,
unrecognised_format: bool,
) -> BaselineStaleness
pub fn to_envelope( &self, moved_entries: usize, scope_reasons: BaselineScopeReasons, unrecognised_format: bool, ) -> BaselineStaleness
This run’s machine-readable view of the baseline, for the JSON envelope.
Every member is derived here rather than in a consumer, so the advisory
threshold and the gate rule have exactly one implementation. Only
health can follow a file move; the commands that match entries by
fingerprint pass 0.
scope_reasons and unrecognised_format come from the caller because
only the command knows which channels it read and which format it read
the file as; this struct carries the counts the analysis needs and
nothing more. change_scoped and scope_reasons must agree, which is
why every caller derives the boolean from the same reason set it passes
here.
unrecognised_format widens gate_trips here, at the single site that
builds it, so the opt-in gate, the exit code, every CI surface that reads
the boolean and the MCP sentences move together: a file this command
cannot read as its own suppresses nothing, which no count can express.
Unlike the count rule it is not suppressed by change_scoped, because
telling a foreign file from this command’s own needs no project-wide run.
Trait Implementations§
Source§impl Clone for BaselineStaleness
impl Clone for BaselineStaleness
impl Copy for BaselineStaleness
Source§impl Debug for BaselineStaleness
impl Debug for BaselineStaleness
impl Eq for BaselineStaleness
Source§impl PartialEq for BaselineStaleness
impl PartialEq for BaselineStaleness
impl StructuralPartialEq for BaselineStaleness
Auto Trait Implementations§
impl Freeze for BaselineStaleness
impl RefUnwindSafe for BaselineStaleness
impl Send for BaselineStaleness
impl Sync for BaselineStaleness
impl Unpin for BaselineStaleness
impl UnsafeUnpin for BaselineStaleness
impl UnwindSafe for BaselineStaleness
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more