Skip to content

Commit

Permalink
refactor(composer): Simply use getValue() for consistency
Browse files Browse the repository at this point in the history
If values are expected to exist in a map, the code base usually simply
uses `getValue()`.

Signed-off-by: Frank Viernau <[email protected]>
  • Loading branch information
fviernau committed Jul 23, 2024
1 parent 1df5d29 commit bfacb16
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions plugins/package-managers/composer/src/main/kotlin/Composer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
package org.ossreviewtoolkit.plugins.packagemanagers.composer

import java.io.File
import java.io.IOException

import org.apache.logging.log4j.kotlin.logger

Expand Down Expand Up @@ -157,9 +156,6 @@ class Composer(
getScopeDependencies(scopeName).filterNot { packageName ->
packageName.isPlatformDependency() || packageName in virtualPackages // Virtual packages have no metadata.
}.mapNotNullTo(mutableSetOf()) { packageName ->
val childInfo = packageInfoForName[packageName]
?: throw IOException("Could not find package info for $packageName")

if (packageName in dependencyBranch) {
logger.debug {
"Not adding circular dependency '$packageName' to the tree, it is already on this branch of the " +
Expand All @@ -169,6 +165,8 @@ class Composer(
return@mapNotNullTo null
}

val childInfo = packageInfoForName.getValue(packageName)

PackageReference(
id = childInfo.toId(),
dependencies = childInfo.toPackageReferences(
Expand Down

0 comments on commit bfacb16

Please sign in to comment.