Skip to main content

Module complexity

Module complexity 

Source
Expand description

Code complexity analysis module.

This module provides complexity analysis across multiple languages:

  • Cyclomatic Complexity: Measures control flow complexity
  • Cognitive Complexity: Measures understandability
  • Lines of Code (LOC/SLOC): Source line counts
  • Function Length: Average and maximum function lengths
  • Nesting Depth: Maximum nesting level

§Example

use linthis::complexity::{ComplexityAnalyzer, AnalysisOptions};
use std::path::PathBuf;

let analyzer = ComplexityAnalyzer::new();
let options = AnalysisOptions::new(PathBuf::from("."));

let result = analyzer.analyze(&options).expect("Analysis failed");

for file in result.files {
    println!("{}: cyclomatic={}", file.path.display(), file.metrics.cyclomatic);
}

Re-exports§

pub use report::format_complexity_report;
pub use report::ComplexityReportFormat;

Modules§

report
Complexity report formatting module.

Structs§

AnalysisOptions
Options for complexity analysis
AnalysisResult
Result of complexity analysis
ComplexityAnalyzer
Main complexity analyzer
ComplexityMetrics
Complexity metrics for a single entity (file or function)
FileMetrics
Metrics for a single file
FunctionMetrics
Metrics for a single function/method
ThresholdConfig
Threshold levels for different metrics
Thresholds
Collection of all thresholds

Enums§

MetricLevel
Metric severity level