Skip to main content

compute

Function compute 

Source
pub fn compute<D: Doc>(
    metric: Metric,
    lang: &Language,
    root: &AstGrep<D>,
    source: &str,
    exclude_tests: Option<&CfgTestRanges>,
) -> f64
Expand description

Measure metric over an already parsed file.

When exclude_tests is Some, lines and nodes inside #[cfg(test)] ranges do not count, so a production file’s inline test module does not inflate the measurement. When it is None, everything counts.