Skip to main content

Gates

Struct Gates 

pub struct Gates {
Show 14 fields pub cognitive_max: Option<f64>, pub code_health_min: Option<f64>, pub hotspot_score_max: Option<f64>, pub hotspot_anchored_max: Option<f64>, pub disallow_clone_type_1: bool, pub max_dependency_cycles: Option<u32>, pub max_propagation_cost: Option<f64>, pub max_red_effort_pct: Option<f64>, pub red_effort_exempt_improving: bool, pub code_familiarity_min: Option<f64>, pub max_findings_in_hot_files: Option<u32>, pub corpus_percentile_max: Option<f64>, pub fail_on_degraded: bool, pub fail_on_skipped: bool,
}

Fields§

§cognitive_max: Option<f64>

Maximum cognitive complexity per file. Files exceeding fail the gate.

§code_health_min: Option<f64>

Minimum code-health score per file. Files below fail.

§hotspot_score_max: Option<f64>

Maximum hotspot score per file.

§hotspot_anchored_max: Option<f64>

Maximum corpus-anchored hotspot score per file (the hotspot-score-anchored column). Same [0, 10] scale as hotspot_score_max, but the file’s complexity is ranked against the calibration corpus rather than the repo, so improving a file in place does not shift any other file’s anchored score — the complexity term is corpus-anchored. The revisions term stays repo-relative by design, so a change to the revision population itself (a new file clearing min_revs, a refactor commit that reorders the churn ranks) can still move an untouched file’s score; this ceiling carries margin above the measured worst to absorb that, keeping it an absolute standard rather than a moving target.

The gate is skipped (not failed, not passed) when no calibration artifact is active — no embedded world corpus and no --calibration override means hotspot rows carry no hotspot_score_anchored, so there is nothing to compare against. The skip is recorded in the ledger with verdict = "skipped" and printed as a distinct warning line; it does not affect the exit code — mirroring corpus_percentile_max.

§disallow_clone_type_1: bool

Disallow ANY Type-1 clone families.

§max_dependency_cycles: Option<u32>

Maximum number of dependency cycles (non-trivial import-graph SCCs) allowed repo-wide. Exceeding fails the gate. 0 enforces a fully acyclic architecture.

§max_propagation_cost: Option<f64>

Maximum propagation cost (import-graph transitive-closure density, [0,1]). Exceeding fails — a ceiling on “a change to a random file reaches this fraction of the system”.

§max_red_effort_pct: Option<f64>

Maximum share of window LOC churn (lines added + deleted) allowed to land in the red code-health band, as a percentage ([0, 100]). Exceeding fails — enforces “don’t spend most engineering effort fighting fires in the worst-health files.” Missing red band (zero red files) counts as 0 %, which passes any positive threshold.

§red_effort_exempt_improving: bool

Companion to max_red_effort_pct: when true, the ceiling is compared against only the degrading share of red-band window churn — churn that landed in red files whose own health did NOT improve over the window — exempting churn that refactored a red file toward health. Default false leaves the gate comparing the full red churn share (behaviour unchanged). Has no effect unless max_red_effort_pct is also set; like fail_on_degraded it is a modifier, not a gate, so it never makes the thresholds non-empty on its own.

§code_familiarity_min: Option<f64>

Minimum code-familiarity score ([0, 100]). Below this threshold the code-familiarity analysis emits a "risky" verdict. When absent the analysis applies a built-in default of 70.0.

§max_findings_in_hot_files: Option<u32>

Maximum number of "act-now" rows in the finding-hotspot-overlap analysis. Fails the gate when the count exceeds the threshold.

The gate is skipped (not failed, not passed) when the external findings sidecar is absent or empty — a missing sidecar means codelore ingest-sarif has not been run, not that there are zero findings. The skip is recorded in the ledger with verdict = "skipped" and printed as a distinct warning line; it does not affect the exit code.

§corpus_percentile_max: Option<f64>

Maximum corpus-relative percentile ([0,1]) any file may reach. A file whose worst raw metric sits above this fraction of a reference corpus fails the gate — a ceiling on “how extreme is this file versus the world (or your org)”.

The gate is skipped (not failed, not passed) when no calibration artifact is active — no embedded world corpus and no --calibration override means code-health rows carry no corpus_percentile, so there is nothing to compare against. The skip is recorded in the ledger with verdict = "skipped" and printed as a distinct warning line; it does not affect the exit code.

§fail_on_degraded: bool

When true (the default), a gate whose underlying analysis produced no evaluable data where data was expected is recorded as verdict = "degraded" and treated as a failure — a gate must not green on blindness. Set to false to downgrade degraded gates from failure to a warning (the degraded verdict is still printed and recorded in the ledger).

Adapted from the explicit-degradation contract in SAST tooling: an analyzer that silently returns “no findings” on an empty scan is indistinguishable from one that found nothing. Degraded status makes the difference explicit.

§fail_on_skipped: bool

When true, a gate recorded verdict = "skipped" — its underlying analysis had nothing to evaluate (no external-findings sidecar, no calibration artifact, a history shallower than a window, or a change-set that measured no delta) — is treated as a failure, so a gate that silently stopped evaluating is no longer indistinguishable at the exit code from one that evaluated and passed. Default false leaves a skipped gate exit-0 (behaviour unchanged). Honoured by codelore check, codelore gate, and codelore diff; like fail_on_degraded it is a policy modifier, not a gate, so it never makes the thresholds non-empty on its own, and the ledger keeps the honest "skipped" verdict either way.

Trait Implementations§

§

impl Clone for Gates

§

fn clone(&self) -> Gates

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
§

impl Debug for Gates

§

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

Formats the value using the given formatter. Read more
§

impl Default for Gates

§

fn default() -> Gates

Returns the “default value” for a type. Read more
§

impl<'de> Deserialize<'de> for Gates

§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

§

impl Freeze for Gates

§

impl RefUnwindSafe for Gates

§

impl Send for Gates

§

impl Sync for Gates

§

impl Unpin for Gates

§

impl UnsafeUnpin for Gates

§

impl UnwindSafe for Gates

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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