MCPcopy Index your code
hub / github.com/colbymchenry/codegraph / isPolymorphicSibling

Method isPolymorphicSibling

src/mcp/tools.ts:2990–3004  ·  view source on GitHub ↗
(nodes: Node[])

Source from the content-addressed store, hash-verified

2988 const MIN_SIBLINGS = 3;
2989 const siblingSuper = new Map<string, boolean>();
2990 const isPolymorphicSibling = (nodes: Node[]): boolean => {
2991 for (const n of nodes) {
2992 for (const e of cg.getOutgoingEdges(n.id)) {
2993 if (e.kind !== 'implements' && e.kind !== 'extends') continue;
2994 let many = siblingSuper.get(e.target);
2995 if (many === undefined) {
2996 many = cg.getIncomingEdges(e.target)
2997 .filter((x) => x.kind === 'implements' || x.kind === 'extends').length >= MIN_SIBLINGS;
2998 siblingSuper.set(e.target, many);
2999 }
3000 if (many) return true;
3001 }
3002 }
3003 return false;
3004 };
3005
3006 // A file that DEFINES a polymorphic supertype (a class/interface with ≥
3007 // MIN_SIBLINGS implementers) AND co-locates its subclasses is a redundant

Callers

nothing calls this directly

Calls 4

setMethod · 0.80
getMethod · 0.65
getOutgoingEdgesMethod · 0.45
getIncomingEdgesMethod · 0.45

Tested by

no test coverage detected