pub struct Stats { /* private fields */ }Expand description
The Cognitive Complexity metric.
Implementations§
Source§impl Stats
impl Stats
Sourcepub fn merge(&mut self, other: &Stats)
pub fn merge(&mut self, other: &Stats)
Merges a second Cognitive Complexity metric into the first one
Sourcepub fn cognitive_sum(&self) -> f64
pub fn cognitive_sum(&self) -> f64
Returns the Cognitive Complexity sum metric value
Sourcepub fn cognitive_min(&self) -> f64
pub fn cognitive_min(&self) -> f64
Returns the Cognitive Complexity minimum metric value
Sourcepub fn cognitive_max(&self) -> f64
pub fn cognitive_max(&self) -> f64
Returns the Cognitive Complexity maximum metric value
Sourcepub fn cognitive_average(&self) -> f64
pub fn cognitive_average(&self) -> f64
Returns the Cognitive Complexity metric average value
This value is computed dividing the Cognitive Complexity value
for the total number of functions/closures in a space.
If there are no functions in a code, its value is NAN.
Sourcepub fn max_nesting(&self) -> f64
pub fn max_nesting(&self) -> f64
Returns the maximum control-flow nesting depth reached in this space.
Counted as the deepest level of nested branching/looping constructs
(e.g. three nested ifs yield 3); 0 when the space contains no
such construct. Derived from the same nesting the cognitive pass
already tracks.
Sourcepub fn total_nesting(&self) -> f64
pub fn total_nesting(&self) -> f64
Returns the sum of the nesting depth of every branching/looping construct in this space.