Skip to content

Commit

Permalink
chore(aosd): Rename a few variables to singular
Browse files Browse the repository at this point in the history
These are not collections SPDX of expressions.

Signed-off-by: Sebastian Schuberth <[email protected]>
  • Loading branch information
sschuberth committed Dec 18, 2024
1 parent 7b412ef commit 6b68dd8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions plugins/reporters/aosd/src/main/kotlin/Aosd21Reporter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,16 @@ private fun Map<Identifier, IndexedValue<CuratedPackage>>.toComponents(
val nonExcludedLicenseInfo = input.licenseInfoResolver.resolveLicenseInfo(pkg.metadata.id).filterExcluded()
val relevantLicenseInfo = nonExcludedLicenseInfo.filter(LicenseView.CONCLUDED_OR_DECLARED_AND_DETECTED)

val licenseExpressions = relevantLicenseInfo.toSimplifiedCompoundExpression()
val licenseExpression = relevantLicenseInfo.toSimplifiedCompoundExpression()

val selectedLicenseInfo = relevantLicenseInfo
.applyChoices(input.ortResult.getPackageLicenseChoices(pkg.metadata.id))
.applyChoices(input.ortResult.getRepositoryLicenseChoices())

val selectedExpressions = selectedLicenseInfo.toSimplifiedCompoundExpression()
.takeUnless { it == licenseExpressions }
val selectedExpression = selectedLicenseInfo.toSimplifiedCompoundExpression()
.takeUnless { it == licenseExpression }

val licenseTexts = licenseExpressions.licenses().mapNotNullTo(mutableSetOf()) { license ->
val licenseTexts = licenseExpression.licenses().mapNotNullTo(mutableSetOf()) { license ->
input.licenseTextProvider.getLicenseText(license)
}.joinToString("\n--\n") { it.trimEnd() }

Expand All @@ -111,13 +111,13 @@ private fun Map<Identifier, IndexedValue<CuratedPackage>>.toComponents(
subcomponents = listOf(
AOSD21.Subcomponent(
subcomponentName = FIRST_SUBCOMPONENT_NAME,
spdxId = licenseExpressions.nullOrBlankToSpdxNoassertionOrNone(),
spdxId = licenseExpression.nullOrBlankToSpdxNoassertionOrNone(),
copyrights = relevantLicenseInfo.getCopyrights().sorted(),
authors = pkg.metadata.authors.sorted(),
licenseText = licenseTexts,
// Can be empty as the license information is the result of a file level scan.
licenseTextUrl = "",
selectedLicense = selectedExpressions?.toString().orEmpty()
selectedLicense = selectedExpression?.toString().orEmpty()
).validate()
)
).validate()
Expand Down

0 comments on commit 6b68dd8

Please sign in to comment.