diff --git a/model/src/main/kotlin/licenses/DefaultLicenseInfoProvider.kt b/model/src/main/kotlin/licenses/DefaultLicenseInfoProvider.kt index 8430407735aac..04951bbb899cf 100644 --- a/model/src/main/kotlin/licenses/DefaultLicenseInfoProvider.kt +++ b/model/src/main/kotlin/licenses/DefaultLicenseInfoProvider.kt @@ -90,36 +90,39 @@ class DefaultLicenseInfoProvider( // turn around time / without re-scanning. it.filterByVcsPath(ortResult.getPackage(id)?.metadata?.vcsProcessed?.path.orEmpty()) }.forEach { (provenance, _, summary, _) -> - val (licenseFindingCurations, pathExcludes, relativeFindingsPath) = getConfiguration(id, provenance) + val config = getConfiguration(id, provenance) findings += Findings( provenance = provenance, licenses = summary.licenseFindings, copyrights = summary.copyrightFindings, - licenseFindingCurations = licenseFindingCurations, - pathExcludes = pathExcludes, - relativeFindingsPath = relativeFindingsPath + licenseFindingCurations = config.licenseFindingCurations, + pathExcludes = config.pathExcludes, + relativeFindingsPath = config.relativeFindingsPath ) } return DetectedLicenseInfo(findings) } - private fun getConfiguration( - id: Identifier, - provenance: Provenance - ): Triple, List, String> = + private fun getConfiguration(id: Identifier, provenance: Provenance): Configuration = ortResult.getProject(id)?.let { project -> - Triple( + Configuration( ortResult.repository.config.curations.licenseFindings, ortResult.repository.config.excludes.paths, ortResult.repository.getRelativePath(project.vcsProcessed).orEmpty() ) } ?: packageConfigurationProvider.getPackageConfigurations(id, provenance).let { packageConfigurations -> - Triple( + Configuration( packageConfigurations.flatMap { it.licenseFindingCurations }, packageConfigurations.flatMap { it.pathExcludes }, "" ) } } + +private data class Configuration( + val licenseFindingCurations: List, + val pathExcludes: List, + val relativeFindingsPath: String +)