Skip to main content

Module helpers

Module helpers 

Source
Expand description

Convenience helpers for common code entities and relationships.

This module provides higher-level abstractions for working with code graphs, reducing boilerplate for common operations like adding files, functions, classes, and tracking relationships between them.

Structs§

FunctionMetadata
Metadata for a function with extended properties.

Functions§

add_call
Add a function call relationship with line metadata.
add_class
Add a class node and automatically link it to a file.
add_file
Add a file node to the graph.
add_function
Add a function node and automatically link it to a file.
add_function_with_metadata
Add a function node with extended metadata.
add_import
Add an import relationship with imported symbols.
add_method
Add a method node and link it to a class.
add_module
Add a module node to the graph.
call_chain
Find all call chains (paths) between two functions.
circular_deps
Detect circular dependencies in file imports.
find_file_by_path
Find a file node by its path.
get_callees
Get all functions called by the given function.
get_callers
Get all functions that call the given function.
get_file_dependencies
Get all files that a file depends on (imports from).
get_file_dependents
Get all files that depend on this file (import this file).
get_functions_in_file
Get all functions contained in a file.
link_to_file
Create a generic Contains edge between two nodes.
node_ids_to_paths
Convert a slice of node IDs to their corresponding file paths.
transitive_dependencies
Find all transitive dependencies of a file (what it imports, directly or indirectly).
transitive_dependents
Find all transitive dependents of a file (what imports it, directly or indirectly).