Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(aosd): Rename a few variables to singular #9642

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading