pub struct ThresholdConfig {
pub global: f64,
pub overrides: Vec<ThresholdOverride>,
}Expand description
Threshold configuration with optional per-path overrides.
When overrides are present, each function’s file path is tested against the override patterns in declaration order. The last matching override wins. If no override matches, the global threshold applies.
Fields§
§global: f64Global CRAP threshold (used when no override matches).
overrides: Vec<ThresholdOverride>Per-path overrides, evaluated in order (last match wins).
Implementations§
Source§impl ThresholdConfig
impl ThresholdConfig
Sourcepub fn has_overrides(&self) -> bool
pub fn has_overrides(&self) -> bool
Returns true if any per-path overrides are configured.
Trait Implementations§
Source§impl Clone for ThresholdConfig
impl Clone for ThresholdConfig
Source§fn clone(&self) -> ThresholdConfig
fn clone(&self) -> ThresholdConfig
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 ThresholdConfig
impl Debug for ThresholdConfig
Source§impl Default for ThresholdConfig
Returns the cognitive-metric default cutoff. Default cannot take
a metric argument, so it cannot be metric-correct on its own — it
is the cognitive baseline only.
impl Default for ThresholdConfig
Returns the cognitive-metric default cutoff. Default cannot take
a metric argument, so it cannot be metric-correct on its own — it
is the cognitive baseline only.
The CLI never relies on this: the analysis path resolves the
metric-correct global through merge_threshold (CLI > config >
adapter default, keyed on the effective metric) and constructs
ThresholdConfig directly, bypassing Default. The remaining
Default use is a struct-field initializer that is overwritten
before any analysis runs.
A library embedder that needs a metric-correct config should build
it explicitly rather than via Default:
let metric = ComplexityMetric::Cyclomatic;
let config = ThresholdConfig {
global: ThresholdPreset::Default.threshold(metric),
overrides: Vec::new(),
};Source§impl PartialEq for ThresholdConfig
impl PartialEq for ThresholdConfig
Source§fn eq(&self, other: &ThresholdConfig) -> bool
fn eq(&self, other: &ThresholdConfig) -> bool
self and other values to be equal, and is used by ==.