From aaeff85731c942cca2ac1323c1cd769d740b0317 Mon Sep 17 00:00:00 2001 From: Frank Viernau Date: Thu, 18 Jul 2024 15:21:00 +0200 Subject: [PATCH] refactor(bower): Reword obsolete uses of the terminology of nodes A preceding commit refactored Bower to use data classes and a model mapper for the deserilation. So, it now operates on `PackageInfo` instances instead of on `JsonNode`s. Align variable names, funcation names and comments with that change, to make things consistent again. Signed-off-by: Frank Viernau --- .../bower/src/main/kotlin/Bower.kt | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/plugins/package-managers/bower/src/main/kotlin/Bower.kt b/plugins/package-managers/bower/src/main/kotlin/Bower.kt index 1857afcbfd95a..3801a288cb102 100644 --- a/plugins/package-managers/bower/src/main/kotlin/Bower.kt +++ b/plugins/package-managers/bower/src/main/kotlin/Bower.kt @@ -194,7 +194,7 @@ private val PackageInfo.key: String? } -private fun getNodesWithCompleteDependencies(info: PackageInfo): Map { +private fun getPackageInfosWithCompleteDependencies(info: PackageInfo): Map { val result = mutableMapOf() val stack = Stack().apply { push(info) } @@ -218,26 +218,27 @@ private fun getNodesWithCompleteDependencies(info: PackageInfo): Map = getNodesWithCompleteDependencies(info) + alternativeInfos: Map = getPackageInfosWithCompleteDependencies(info) ): Set { val result = mutableSetOf() if (!hasCompleteDependencies(info, scopeName)) { - // Bower leaves out a dependency entry for a child if there exists a similar node to its parent node + // Bower leaves out a dependency entry for a child if there exists a similar entry to its parent entry // with the exact same name and resolved target. This makes it necessary to retrieve the information - // about the subtree rooted at the parent from that other node containing the full dependency + // about the subtree rooted at the parent from that other entry containing the full dependency // information. // See https://github.com/bower/bower/blob/6bc778d/lib/core/Manager.js#L557 and below. - val alternativeNode = alternativeNodes.getValue(info.key!!) - return parseDependencyTree(alternativeNode, scopeName, alternativeNodes) + + val alternativeInfo = alternativeInfos.getValue(info.key!!) + return parseDependencyTree(alternativeInfo, scopeName, alternativeInfos) } info.pkgMeta.getDependencies(scopeName).keys.forEach { - val childNode = info.dependencies.getValue(it) + val childInfo = info.dependencies.getValue(it) val childScope = SCOPE_NAME_DEPENDENCIES - val childDependencies = parseDependencyTree(childNode, childScope, alternativeNodes) + val childDependencies = parseDependencyTree(childInfo, childScope, alternativeInfos) val packageReference = PackageReference( - id = parsePackageId(childNode), + id = parsePackageId(childInfo), dependencies = childDependencies ) result += packageReference