macaron.code_analyzer package

Submodules

macaron.code_analyzer.call_graph module

This module contains classes to generate build call graphs for the target repository.

class macaron.code_analyzer.call_graph.BaseNode(caller=None, node_id=None)

Bases: Generic[Node]

This is the generic class for call graph nodes.

__init__(caller=None, node_id=None)

Initialize instance.

Parameters:
  • caller (Node | None) – The caller node.

  • node_id (str | None) – The unique identifier of a node in the callgraph.

add_callee(node)

Add a callee to the current node.

Parameters:

node (Node) – The callee node.

Return type:

None

has_callee()

Check if the current node has callees.

Returns:

Return False if there are no callees, otherwise True.

Return type:

bool

class macaron.code_analyzer.call_graph.CallGraph(root, repo_path)

Bases: Generic[Node]

This is the generic class for creating a call graph.

__init__(root, repo_path)

Initialize instance.

Parameters:
  • root (Node) – The root call graph node.

  • repo_path (str) – The path to the repo.

get_root()

Get the root node in the call graph.

Returns:

The root node.

Return type:

Node

bfs()

Traverse the call graph in breadth first search order.

Yields:

Node – The traversed nodes.

Return type:

Iterable[TypeVar(Node, bound= BaseNode)]