diff --git a/reporter/src/main/kotlin/StatisticsCalculator.kt b/reporter/src/main/kotlin/StatisticsCalculator.kt index a99d94cac64c7..d2c2a667e7081 100644 --- a/reporter/src/main/kotlin/StatisticsCalculator.kt +++ b/reporter/src/main/kotlin/StatisticsCalculator.kt @@ -118,8 +118,6 @@ object StatisticsCalculator { ortResult: OrtResult, licenseInfoResolver: LicenseInfoResolver ): LicenseStatistics { - val ids = ortResult.getProjectsAndPackages() - fun Collection.countLicenses( transform: ResolvedLicenseInfo.() -> ResolvedLicenseInfo = { this } ): Map = @@ -128,12 +126,11 @@ object StatisticsCalculator { transform(resolvedLicenseInfo).map { it.license.toString() } }.groupingBy { it }.eachCount().toMap() - val declaredLicenses = ids.countLicenses { filter(LicenseView.ONLY_DECLARED) } - val detectedLicenses = ids.countLicenses { filter(LicenseView.ONLY_DETECTED) } + val ids = ortResult.getProjectsAndPackages() return LicenseStatistics( - declared = declaredLicenses, - detected = detectedLicenses + declared = ids.countLicenses { filter(LicenseView.ONLY_DECLARED) }, + detected = ids.countLicenses { filter(LicenseView.ONLY_DETECTED) } ) }