MCPcopy Create free account
hub / github.com/SAP/ui5-project / _checkCycle

Method _checkCycle

lib/graph/ProjectGraph.js:622–630  ·  view source on GitHub ↗
(ancestors, projectName)

Source from the content-addressed store, hash-verified

620 }
621
622 _checkCycle(ancestors, projectName) {
623 if (ancestors.includes(projectName)) {
624 // "Back-edge" detected. Neither BFS nor DFS searches should continue
625 // Mark first and last occurrence in chain with an asterisk and throw an error detailing the
626 // problematic dependency chain
627 ancestors[ancestors.indexOf(projectName)] = `*${projectName}*`;
628 throw new Error(`Detected cyclic dependency chain: ${ancestors.join(" -> ")} -> *${projectName}*`);
629 }
630 }
631
632 // TODO: introduce function to check for dangling nodes/consistency in general?
633}

Callers 2

traverseBreadthFirstMethod · 0.95
_traverseDepthFirstMethod · 0.95

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected