Reference

compute_metrics(file_name, code, unit) builtin

Calculates various code metrics for the provided code. Imitates the behavior of the metrics REST API endpoint of rust-code-analysis-web.

Parameters:
  • file_name (str) –

    The name of the file being analyzed (used to infer the language)

  • code (str) –

    The source code string to analyze

  • unit (bool) –

    A boolean flag. True returns only top level metrics, False returns metrics recursively.

Returns:
  • dict

    A dictionary containing the calculated metrics.

remove_comments(file_name, code) builtin

Removes comments from the provided code. Imitates the behavior of the remove_comments REST API endpoint of rust-code-analysis-web.

Parameters:
  • file_name (str) –

    The name of the file being processed (used to infer the language)

  • code (str) –

    The source code string from which comments will be removed

Returns:
  • str

    A string containing the code with comments removed.