Skip to main content

detect_complex_functions

Function detect_complex_functions 

Source
pub fn detect_complex_functions(
    cpg: &CodePropertyGraph,
    _threshold: usize,
) -> Vec<ComplexityRecord>
Expand description

Computes the AST‑node count for every function (and method) in the graph.

The traversal follows AstChild edges once from each function root, using a visited set to prevent infinite loops caused by structural cycles (e.g. a class containing a method that references the class). A hard limit of MAX_NODES_PER_FUNCTION (100 000) is enforced per function; nodes beyond the limit are not visited.

§Arguments

  • cpg – The Code Property Graph.
  • _threshold – Unused; retained for API compatibility.

§Returns

A vector of ComplexityRecord for every Function node.