From fd05e38a1a009c40885522904234c991b45917a9 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, function names and comments with that change, to make things consistent again. Signed-off-by: Frank Viernau --- .../bower/src/main/kotlin/Bower.kt | 18 +++++++++--------- 1 file changed, 9 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 4200e3331f602..31ccbe0933b4a 100644 --- a/plugins/package-managers/bower/src/main/kotlin/Bower.kt +++ b/plugins/package-managers/bower/src/main/kotlin/Bower.kt @@ -193,7 +193,7 @@ private val PackageInfo.key: String? return "$name:$version".takeUnless { name.isEmpty() || version.isEmpty() } } -private fun getNodesWithCompleteDependencies(info: PackageInfo): Map { +private fun getPackageInfosWithCompleteDependencies(info: PackageInfo): Map { val result = mutableMapOf() val stack = Stack().apply { push(info) } @@ -217,27 +217,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. @Suppress("UnsafeCallOnNullableType") - val alternativeNode = alternativeNodes.getValue(info.key!!) - return parseDependencyTree(alternativeNode, scopeName, alternativeNodes) + val alternativeNode = alternativeInfos.getValue(info.key!!) + return parseDependencyTree(alternativeNode, 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