pub enum ThresholdPreset {
Strict,
Default,
Lenient,
}Expand description
Named threshold preset — a calibration tier, independent of
metric. The concrete f64 cutoff is resolved per metric via
ThresholdPreset::threshold (the same tier maps to a different
number for cyclomatic vs cognitive scores).
Variants§
Strict
High-quality libraries, safety-critical code. Gates at the Low → Acceptable risk boundary (cognitive 8, cyclomatic 8).
Default
Typical projects (balanced) — the tier used when no preset or explicit threshold is given. Gates at the Acceptable → Moderate risk boundary (cognitive 15, cyclomatic 15).
Lenient
Legacy or transitional code. Gates at the Moderate → High risk boundary (cognitive 25, cyclomatic 25).
Implementations§
Source§impl ThresholdPreset
impl ThresholdPreset
Sourcepub fn threshold(self, metric: ComplexityMetric) -> f64
pub fn threshold(self, metric: ComplexityMetric) -> f64
Resolve this tier to its concrete f64 CRAP cutoff for metric.
This is the single place tier→number is keyed on the metric:
--strict / --lenient / config preset / the no-flag
default all route through it, so a cutoff calibrated for one
metric is never silently applied to the other metric’s
(different-magnitude) scores.
Trait Implementations§
Source§impl Clone for ThresholdPreset
impl Clone for ThresholdPreset
Source§fn clone(&self) -> ThresholdPreset
fn clone(&self) -> ThresholdPreset
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ThresholdPreset
impl Debug for ThresholdPreset
Source§impl PartialEq for ThresholdPreset
impl PartialEq for ThresholdPreset
Source§fn eq(&self, other: &ThresholdPreset) -> bool
fn eq(&self, other: &ThresholdPreset) -> bool
self and other values to be equal, and is used by ==.impl Copy for ThresholdPreset
impl Eq for ThresholdPreset
impl StructuralPartialEq for ThresholdPreset
Auto Trait Implementations§
impl Freeze for ThresholdPreset
impl RefUnwindSafe for ThresholdPreset
impl Send for ThresholdPreset
impl Sync for ThresholdPreset
impl Unpin for ThresholdPreset
impl UnsafeUnpin for ThresholdPreset
impl UnwindSafe for ThresholdPreset
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§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.