diff --git a/src/main/java/com/jfrog/ide/idea/scan/ScannerBase.java b/src/main/java/com/jfrog/ide/idea/scan/ScannerBase.java index 1fd43891..22826062 100644 --- a/src/main/java/com/jfrog/ide/idea/scan/ScannerBase.java +++ b/src/main/java/com/jfrog/ide/idea/scan/ScannerBase.java @@ -185,7 +185,7 @@ private void scanAndUpdate(ProgressIndicator indicator) { * @param vulnerableDependencies a map of component IDs and the DependencyNode object matching each of them. * @param depTree the project's dependency tree to walk through. */ - protected List walkDepTree(Map vulnerableDependencies, DepTree depTree) throws IOException { + private List walkDepTree(Map vulnerableDependencies, DepTree depTree) { Map descriptorNodes = new HashMap<>(); visitDepTreeNode(vulnerableDependencies, depTree, Collections.singletonList(depTree.getRootId()), descriptorNodes, new ArrayList<>(), new HashMap<>()); return new CopyOnWriteArrayList<>(descriptorNodes.values()); diff --git a/src/main/java/com/jfrog/ide/idea/scan/SingleDescriptorScanner.java b/src/main/java/com/jfrog/ide/idea/scan/SingleDescriptorScanner.java index 4d6b863c..ddc617c2 100644 --- a/src/main/java/com/jfrog/ide/idea/scan/SingleDescriptorScanner.java +++ b/src/main/java/com/jfrog/ide/idea/scan/SingleDescriptorScanner.java @@ -1,18 +1,12 @@ package com.jfrog.ide.idea.scan; import com.intellij.openapi.project.Project; -import com.jfrog.ide.common.deptree.DepTree; -import com.jfrog.ide.common.nodes.DependencyNode; -import com.jfrog.ide.common.nodes.FileTreeNode; import com.jfrog.ide.common.scan.ComponentPrefix; import com.jfrog.ide.common.scan.ScanLogic; import com.jfrog.ide.idea.ui.ComponentsTree; import com.jfrog.ide.idea.ui.menus.filtermanager.ConsistentFilterManager; import org.jetbrains.annotations.NotNull; -import java.io.IOException; -import java.util.List; -import java.util.Map; import java.util.concurrent.ExecutorService; public abstract class SingleDescriptorScanner extends ScannerBase { @@ -45,8 +39,4 @@ public abstract class SingleDescriptorScanner extends ScannerBase { ScanLogic scanLogic) { this(project, basePath, prefix, executor, "", scanLogic); } - - protected List walkDepTree(Map vulnerableDependencies, DepTree depTree) throws IOException { - return super.walkDepTree(vulnerableDependencies, depTree); - } } diff --git a/src/main/java/com/jfrog/ide/idea/scan/YarnScanner.java b/src/main/java/com/jfrog/ide/idea/scan/YarnScanner.java index 6e4b60c9..20642e7f 100644 --- a/src/main/java/com/jfrog/ide/idea/scan/YarnScanner.java +++ b/src/main/java/com/jfrog/ide/idea/scan/YarnScanner.java @@ -7,9 +7,6 @@ import com.intellij.psi.PsiManager; import com.intellij.util.EnvironmentUtil; import com.jfrog.ide.common.deptree.DepTree; -import com.jfrog.ide.common.nodes.DependencyNode; -import com.jfrog.ide.common.nodes.DescriptorFileTreeNode; -import com.jfrog.ide.common.nodes.FileTreeNode; import com.jfrog.ide.common.scan.ComponentPrefix; import com.jfrog.ide.common.scan.ScanLogic; import com.jfrog.ide.common.yarn.YarnTreeBuilder; @@ -18,13 +15,9 @@ import com.jfrog.ide.idea.scan.data.PackageManagerType; import com.jfrog.ide.idea.ui.ComponentsTree; import com.jfrog.ide.idea.ui.menus.filtermanager.ConsistentFilterManager; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.StringUtils; import java.io.IOException; import java.nio.file.Paths; -import java.util.*; -import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.ExecutorService; /** @@ -70,32 +63,5 @@ protected AbstractInspection getInspectionTool() { protected PackageManagerType getPackageManagerType() { return PackageManagerType.YARN; } - - private Map> getPackageNameToVersionsMap(Set packages) { - Map> packageNameToVersions = new HashMap<>(); - for (String fullNamePackage : CollectionUtils.emptyIfNull(packages)) { - String[] packageSplit = StringUtils.split(fullNamePackage, ":"); - String packageName = packageSplit[0]; - String packageVersion = packageSplit[1]; - packageNameToVersions.putIfAbsent(packageName, new HashSet<>()); - packageNameToVersions.get(packageName).add(packageVersion); - } - return packageNameToVersions; - } - - @Override - protected List walkDepTree(Map vulnerableDependencies, DepTree depTree) throws IOException { - Map descriptorNodes = new HashMap<>(); - - Map> packageNameToVersions = getPackageNameToVersionsMap(vulnerableDependencies.keySet()); - - for (Map.Entry> entry : packageNameToVersions.entrySet()) { - String packageName = entry.getKey(); - Set packageVersions = entry.getValue(); - DepTree depTree1 = yarnTreeBuilder.findDependencyPath(getLog(), packageName, packageVersions); - } - - return new CopyOnWriteArrayList<>(descriptorNodes.values()); - } }