MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / callsFrom

Function callsFrom

__tests__/rust-module-path-call.test.ts:237–241  ·  view source on GitHub ↗
(file: string, name: string)

Source from the content-addressed store, hash-verified

235
236/** What the function `name` in `file` calls, as `kind qualifiedName file:line`. */
237const callsFrom = (file: string, name: string): string[] => {
238 const fn = cg.getNodesInFile(file).find((n) => n.name === name)!;
239 return cg.getOutgoingEdgesFrom([fn.id]).filter((e) => e.kind === 'calls')
240 .map((e) => cg.getNode(e.target)!).map((t) => `${t.kind} ${t.qualifiedName} ${t.filePath}:${t.startLine}`);
241};
242
243describe('Rust calls through a module path', () => {
244 it('reach the free function the module declares, never a same-named method or local fn', () => {

Callers 1

Calls 4

mapMethod · 0.80
getNodeMethod · 0.80
getNodesInFileMethod · 0.65
getOutgoingEdgesFromMethod · 0.45

Tested by

no test coverage detected