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

Method isPolymorphicSibling

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

Source from the content-addressed store, hash-verified

5662 const MIN_SIBLINGS = 3;
5663 const siblingSuper = new Map<string, boolean>();
5664 const isPolymorphicSibling = (nodes: Node[]): boolean => {
5665 for (const n of nodes) {
5666 for (const e of cg.getOutgoingEdges(n.id)) {
5667 if (e.kind !== 'implements' && e.kind !== 'extends') continue;
5668 let many = siblingSuper.get(e.target);
5669 if (many === undefined) {
5670 many = cg.getIncomingEdges(e.target)
5671 .filter((x) => x.kind === 'implements' || x.kind === 'extends').length >= MIN_SIBLINGS;
5672 siblingSuper.set(e.target, many);
5673 }
5674 if (many) return true;
5675 }
5676 }
5677 return false;
5678 };
5679
5680 // A file that DEFINES a polymorphic supertype (a class/interface with ≥
5681 // MIN_SIBLINGS implementers) AND co-locates its subclasses is a redundant

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected