Skip to main content

compute_complexity

Function compute_complexity 

Source
pub fn compute_complexity(content: &str, language: Language) -> Option<u32>
Expand description

Compute the cyclomatic complexity score for a chunk of source code.

Returns Some(score) where score >= 1 for supported languages, or None if the language is unsupported or parsing fails.

The score is 1 + count(branch_nodes) where branch nodes are language-specific AST nodes representing control flow decisions.