snyk-mvn-plugin
Advanced tools
Comparing version 3.4.0 to 3.4.1
@@ -12,3 +12,3 @@ "use strict"; | ||
const queue = []; | ||
queue.push(...getItems(rootId, nodes[rootId])); | ||
queue.push(...getItems(rootId, [], nodes[rootId])); | ||
// breadth first search | ||
@@ -19,3 +19,3 @@ while (queue.length > 0) { | ||
continue; | ||
const { id, parentId } = item; | ||
const { id, ancestry, parentId } = item; | ||
const parsed = parseId(id); | ||
@@ -35,2 +35,12 @@ const node = nodes[id]; | ||
} | ||
// If verbose is enabled and our ancestry includes ourselves | ||
// we are cyclic and should be pruned :) | ||
if (verboseEnabled && ancestry.includes(id)) { | ||
const prunedId = visited.id + ':pruned-cycle'; | ||
builder.addPkgNode(visited.pkgInfo, prunedId, { | ||
labels: { pruned: 'cyclic' }, | ||
}); | ||
builder.connectDep(parentId, prunedId); | ||
continue; // don't queue any more children | ||
} | ||
const parentNodeId = parentId === rootId ? builder.rootNodeId : parentId; | ||
@@ -47,3 +57,4 @@ if (verboseEnabled && visited) { | ||
} | ||
queue.push(...getItems(id, node)); | ||
// Remember to push updated ancestry here | ||
queue.push(...getItems(id, [...ancestry, id], node)); | ||
} | ||
@@ -53,6 +64,6 @@ return builder.build(); | ||
exports.buildDepGraph = buildDepGraph; | ||
function getItems(parentId, node) { | ||
function getItems(parentId, ancestry, node) { | ||
const items = []; | ||
for (const id of node?.dependsOn || []) { | ||
items.push({ id, parentId }); | ||
items.push({ id, ancestry, parentId }); | ||
} | ||
@@ -59,0 +70,0 @@ return items; |
@@ -62,3 +62,3 @@ { | ||
}, | ||
"version": "3.4.0" | ||
"version": "3.4.1" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
60532
782