Skip to content
Permalink
Browse files

DeclaredLicenseProcessor: Rewrite an empty-check before reducing

To be more Kotlin-ish.

Signed-off-by: Sebastian Schuberth <sebastian.schuberth@bosch-si.com>
  • Loading branch information...
sschuberth committed Oct 9, 2019
1 parent da7e3a8 commit b60c7509d1bb2591300df26030f0fcb5e13d4bd4
Showing with 1 addition and 5 deletions.
  1. +1 −5 utils/src/main/kotlin/DeclaredLicenseProcessor.kt
@@ -74,11 +74,7 @@ object DeclaredLicenseProcessor {
process(declaredLicense)?.let { processedLicenses += it } ?: run { unmapped += declaredLicense }
}

val spdxExpression = when {
processedLicenses.isEmpty() -> null
else -> processedLicenses.reduce { left, right -> left and right }
}

val spdxExpression = processedLicenses.takeUnless { it.isEmpty() }?.reduce { left, right -> left and right }
return ProcessedDeclaredLicense(spdxExpression, unmapped)
}

0 comments on commit b60c750

Please sign in to comment.
You can’t perform that action at this time.