pub struct ComplexityMetrics {Show 13 fields
pub cyclomatic_complexity: usize,
pub max_nesting_depth: usize,
pub function_count: usize,
pub logical_lines: usize,
pub comment_lines: usize,
pub blank_lines: usize,
pub total_lines: usize,
pub cognitive_complexity: usize,
pub maintainability_index: f64,
pub average_function_length: f64,
pub code_density: f64,
pub comment_ratio: f64,
pub language_metrics: LanguageSpecificMetrics,
}
Expand description
Comprehensive complexity metrics for a code file
Fields§
§cyclomatic_complexity: usize
Cyclomatic complexity (McCabe complexity)
max_nesting_depth: usize
Maximum nesting depth
function_count: usize
Total number of functions/methods
logical_lines: usize
Number of logical lines of code (excluding comments and blanks)
comment_lines: usize
Number of comment lines
blank_lines: usize
Number of blank lines
total_lines: usize
Total physical lines
cognitive_complexity: usize
Cognitive complexity (easier to understand than cyclomatic)
maintainability_index: f64
Maintainability index (0-100, higher is better)
average_function_length: f64
Average function length
code_density: f64
Code density (logical lines / total lines)
comment_ratio: f64
Comment ratio (comment lines / logical lines)
language_metrics: LanguageSpecificMetrics
Language-specific metrics
Implementations§
Source§impl ComplexityMetrics
impl ComplexityMetrics
Sourcepub fn complexity_score(&self) -> f64
pub fn complexity_score(&self) -> f64
Get a complexity score (0-1, where higher means more complex)
Sourcepub fn exceeds_thresholds(
&self,
thresholds: &ComplexityThresholds,
) -> Vec<String>
pub fn exceeds_thresholds( &self, thresholds: &ComplexityThresholds, ) -> Vec<String>
Check if any complexity thresholds are exceeded
Trait Implementations§
Source§impl Clone for ComplexityMetrics
impl Clone for ComplexityMetrics
Source§fn clone(&self) -> ComplexityMetrics
fn clone(&self) -> ComplexityMetrics
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ComplexityMetrics
impl Debug for ComplexityMetrics
Source§impl<'de> Deserialize<'de> for ComplexityMetrics
impl<'de> Deserialize<'de> for ComplexityMetrics
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ComplexityMetrics
impl RefUnwindSafe for ComplexityMetrics
impl Send for ComplexityMetrics
impl Sync for ComplexityMetrics
impl Unpin for ComplexityMetrics
impl UnwindSafe for ComplexityMetrics
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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