topos.functors.probes.ast.complexity

Per-Function Complexity Analysis

Provides a function-level breakdown of complexity using the AST. This is separate from the CFG-based module-level cyclomatic complexity used in the main program evaluation (SIMPLE generator).

topos.functors.probes.ast.complexity.calculate_function_complexities(ast)[source]

Calculate cyclomatic complexity for each function in the AST.

Parameters:

ast – The ProgramObject to analyze.

Returns:

A dictionary mapping function names to their complexity scores.

topos.functors.probes.ast.complexity.calculate_max_function_complexity(ast)[source]

Calculate the maximum cyclomatic complexity found in any function.