MCPcopy Create free account
hub / github.com/CodeGraphContext/CodeGraphContext / isLikelyNoiseNode

Function isLikelyNoiseNode

website/src/lib/pr-insights.ts:56–83  ·  view source on GitHub ↗
(node: PRNode, directNodes: PRNode[])

Source from the content-addressed store, hash-verified

54}
55
56function isLikelyNoiseNode(node: PRNode, directNodes: PRNode[]): boolean {
57 if (node.prZone !== "direct") return false;
58
59 const sameDiffCount = directNodes.filter(
60 (n) => n.gitDiff && node.gitDiff && n.gitDiff === node.gitDiff
61 ).length;
62
63 const diff = node.gitDiff || "";
64
65 if (node.type === "Variable") return sameDiffCount > 1;
66
67 if (node.type === "Function" || node.type === "Class") {
68 const diffHeaderMatch = diff.match(/^@@[^\n]*@@[^\n]*/)?.[0] || "";
69 const isHunkAnchor =
70 diffHeaderMatch.includes(`def ${node.name}`) ||
71 diffHeaderMatch.includes(`class ${node.name}`);
72
73 const addedOrChanged =
74 diffAddsOrRemovesSymbol(diff, node.name, "def") ||
75 diffAddsOrRemovesSymbol(diff, node.name, "class") ||
76 (isHunkAnchor && hasAnchorBodyEdit(diff));
77
78 if (!addedOrChanged && sameDiffCount > 1) return true;
79 if (node.name === "<module>" && !diff.startsWith("@@ -0,0")) return true;
80 }
81
82 return false;
83}
84
85function isMeaningfulOrphan(node: PRNode, links: PRLink[]): boolean {
86 if (!node.isOrphan) return false;

Callers 1

computePRInsightsFunction · 0.85

Calls 2

diffAddsOrRemovesSymbolFunction · 0.85
hasAnchorBodyEditFunction · 0.85

Tested by

no test coverage detected