Skip to content

Commit

Permalink
Merge fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
asafgabai committed Nov 30, 2023
1 parent 306bcd0 commit b40fe9a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ repositories {
}

def buildInfoVersion = '2.41.6'
def idePluginsCommonVersion = '2.3.2'
def idePluginsCommonVersion = '2.3.3'

dependencies {
implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.15.2'
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
webviewVersion=0.2.8
webviewVersion=0.2.12
sandboxVersion=2022.3.2
webviewChecksum=6b0bb07998ee6d83037f0278e61a210d22c5234f0906892ed5df4831fd5f7ff1
webviewChecksum=cb88f9fd7fe2380a811c7b290a5aa451b972cdcba84fc9c41e5e274706c79a12
currentVersion=2.6.x-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import java.util.*;

public class ImpactTreeBuilder {
public static final int IMPACT_PATHS_LIMIT = 20;

/**
* Builds impact paths for {@link DependencyNode} objects.
*
Expand All @@ -35,7 +33,7 @@ public static void populateImpactTrees(Map<String, DependencyNode> vulnerableDep
*/
private static void walkParents(DependencyNode depNode, Map<String, Set<String>> parents, String rootId, List<String> path) {
String currParentId = path.get(0);
if (depNode.getImpactTree() != null && depNode.getImpactTree().getImpactPathsCount() >= IMPACT_PATHS_LIMIT) {
if (depNode.getImpactTree() != null && depNode.getImpactTree().getImpactPathsCount() >= ImpactTree.IMPACT_PATHS_LIMIT) {
return;
}
// If we arrived at the root, add the path to the impact tree
Expand All @@ -58,8 +56,7 @@ public static void addImpactPathToDependencyNode(DependencyNode dependencyNode,
dependencyNode.setImpactTree(new ImpactTree(new ImpactTreeNode(path.get(0))));
}
ImpactTree impactTree = dependencyNode.getImpactTree();
impactTree.incImpactPathsCount();
if (impactTree.getImpactPathsCount() > IMPACT_PATHS_LIMIT) {
if (impactTree.getImpactPathsCount() >= ImpactTree.IMPACT_PATHS_LIMIT) {
return;
}
ImpactTreeNode parentImpactTreeNode = impactTree.getRoot();
Expand All @@ -70,6 +67,10 @@ public static void addImpactPathToDependencyNode(DependencyNode dependencyNode,
if (currImpactTreeNode == null) {
currImpactTreeNode = new ImpactTreeNode(currPathNode);
parentImpactTreeNode.getChildren().add(currImpactTreeNode);
if (pathNodeIndex == path.size() - 1) {
// If a new leaf was added, thus a new impact path was added (impact paths don't collide after they split)
impactTree.incImpactPathsCount();
}
}
parentImpactTreeNode = currImpactTreeNode;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public static DependencyPage convertLicenseToDepPage(LicenseViolationNode licens
}

private static ImpactGraph convertImpactGraph(ImpactTree impactTree) {
return new ImpactGraph(convertImpactGraphNode(impactTree.getRoot()), impactTree.getImpactPathsCount() >= ImpactTreeBuilder.IMPACT_PATHS_LIMIT ? impactTree.getImpactPathsCount() : -1);
return new ImpactGraph(convertImpactGraphNode(impactTree.getRoot()), impactTree.getImpactPathsCount() >= ImpactTree.IMPACT_PATHS_LIMIT ? impactTree.getImpactPathsCount() : -1);
}

private static ImpactGraphNode convertImpactGraphNode(ImpactTreeNode impactTreeNode) {
Expand Down

0 comments on commit b40fe9a

Please sign in to comment.