refactor(sonar): Simplified Stream in NpmCliParser.
@@ -101,7 +101,10 @@ public class NpmCliParser {
elements.stream()
.filter(Objects::nonNull)
.filter(elementEntry -> elementEntry.getValue().isJsonObject())
- .forEach(elementEntry -> {
+ .forEach(elementEntry -> processChild(elementEntry, graph, parentDependency, isRootDependency));
+ }
+
+ private void processChild(Entry<String, JsonElement> elementEntry, MutableDependencyGraph graph, Dependency parentDependency, boolean isRootDependency) {
JsonObject element = elementEntry.getValue().getAsJsonObject();
String name = elementEntry.getKey();
String version = Optional.ofNullable(element.getAsJsonPrimitive(JSON_VERSION))
@@ -126,6 +129,4 @@ public class NpmCliParser {
logger.trace(String.format("Excluding Json Element missing name or version: { name: %s, version: %s }", name, version));
}
}
- );
- }
}
