diff --git a/plugins/scanners/fossid/src/main/kotlin/FossId.kt b/plugins/scanners/fossid/src/main/kotlin/FossId.kt index 949aa9da6e8c7..00f3d4d17b686 100644 --- a/plugins/scanners/fossid/src/main/kotlin/FossId.kt +++ b/plugins/scanners/fossid/src/main/kotlin/FossId.kt @@ -876,7 +876,7 @@ class FossId internal constructor( val (licenseFindings, copyrightFindings) = rawResults.markedAsIdentifiedFiles.ifEmpty { rawResults.identifiedFiles - }.mapSummary(ignoredFiles, issues) + }.mapSummary(ignoredFiles, issues, scannerConfig.detectedLicenseMapping) val summary = ScanSummary( startTime = startTime, diff --git a/plugins/scanners/fossid/src/main/kotlin/FossIdScanResults.kt b/plugins/scanners/fossid/src/main/kotlin/FossIdScanResults.kt index e7b6623315a40..3977e14c2d967 100644 --- a/plugins/scanners/fossid/src/main/kotlin/FossIdScanResults.kt +++ b/plugins/scanners/fossid/src/main/kotlin/FossIdScanResults.kt @@ -38,6 +38,7 @@ import org.ossreviewtoolkit.model.Snippet as OrtSnippet import org.ossreviewtoolkit.model.SnippetFinding import org.ossreviewtoolkit.model.TextLocation import org.ossreviewtoolkit.model.createAndLogIssue +import org.ossreviewtoolkit.model.mapLicense import org.ossreviewtoolkit.model.utils.PurlType import org.ossreviewtoolkit.utils.common.collapseToRanges import org.ossreviewtoolkit.utils.common.collectMessages @@ -71,7 +72,8 @@ internal data class FindingsContainer( */ internal fun List.mapSummary( ignoredFiles: Map, - issues: MutableList + issues: MutableList, + detectedLicenseMapping: Map ): FindingsContainer { val licenseFindings = mutableSetOf() val copyrightFindings = mutableSetOf() @@ -83,7 +85,8 @@ internal fun List.mapSummary( summary.licences.forEach { runCatching { - LicenseFinding(it.identifier, location) + // TODO: The license mapping should be moved to a central place. + LicenseFinding(it.identifier.mapLicense(detectedLicenseMapping), location) }.onSuccess { licenseFinding -> licenseFindings += licenseFinding.copy(license = licenseFinding.license.normalize()) }.onFailure { spdxException -> diff --git a/plugins/scanners/fossid/src/test/kotlin/FossIdLicenseMappingTest.kt b/plugins/scanners/fossid/src/test/kotlin/FossIdLicenseMappingTest.kt index e868f96236063..33b85dd97ec98 100644 --- a/plugins/scanners/fossid/src/test/kotlin/FossIdLicenseMappingTest.kt +++ b/plugins/scanners/fossid/src/test/kotlin/FossIdLicenseMappingTest.kt @@ -49,7 +49,7 @@ class FossIdLicenseMappingTest : WordSpec({ val sampleFile = createMarkAsIdentifiedFile("invalid license") val issues = mutableListOf() - val findings = listOf(sampleFile).mapSummary(emptyMap(), issues) + val findings = listOf(sampleFile).mapSummary(emptyMap(), issues, emptyMap()) issues should haveSize(1) issues.first() shouldNotBeNull {