pub struct FunctionMetrics {
pub name: String,
pub start_line: usize,
pub end_line: usize,
pub cognitive: u64,
pub cyclomatic: u64,
pub sloc: u64,
pub exceeds_threshold: Option<bool>,
}Expand description
Metrics for a single function or method.
Each function or method discovered by the AST walker produces one
FunctionMetrics value. Closures and lambdas do not produce their own
entries; they contribute to the metrics of their containing function.
All three complexity dimensions are always populated. The optional
exceeds_threshold field is only set when an AnalysisConfig with a
cognitive_threshold is used.
Fields§
§name: StringFunction or method name (e.g., "process" or "MyStruct::method").
start_line: usize1-based start line number.
end_line: usize1-based end line number.
cognitive: u64Cognitive complexity (SonarSource algorithm).
cyclomatic: u64Cyclomatic complexity (McCabe).
sloc: u64Source lines of code within the function.
exceeds_threshold: Option<bool>Some(true) if cognitive complexity exceeds configured threshold,
Some(false) if within threshold, None if no threshold configured.
Trait Implementations§
Source§impl Clone for FunctionMetrics
impl Clone for FunctionMetrics
Source§fn clone(&self) -> FunctionMetrics
fn clone(&self) -> FunctionMetrics
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 FunctionMetrics
impl Debug for FunctionMetrics
Source§impl<'de> Deserialize<'de> for FunctionMetrics
impl<'de> Deserialize<'de> for FunctionMetrics
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for FunctionMetrics
impl PartialEq for FunctionMetrics
Source§fn eq(&self, other: &FunctionMetrics) -> bool
fn eq(&self, other: &FunctionMetrics) -> bool
self and other values to be equal, and is used by ==.