From eb0e6f15873433db35ba52669bbf795d05d18700 Mon Sep 17 00:00:00 2001 From: Frank Viernau Date: Thu, 23 Nov 2023 08:22:22 +0100 Subject: [PATCH] chore(reporter)!: Remove the unused `SummaryTable` Signed-off-by: Frank Viernau --- reporter/src/main/kotlin/ReportTableModel.kt | 61 ------------------- .../src/main/kotlin/ReportTableModelMapper.kt | 33 ---------- 2 files changed, 94 deletions(-) diff --git a/reporter/src/main/kotlin/ReportTableModel.kt b/reporter/src/main/kotlin/ReportTableModel.kt index 1a87cdb1ddbf3..0a960f30bde9f 100644 --- a/reporter/src/main/kotlin/ReportTableModel.kt +++ b/reporter/src/main/kotlin/ReportTableModel.kt @@ -20,7 +20,6 @@ package org.ossreviewtoolkit.reporter import java.util.SortedMap -import java.util.SortedSet import org.ossreviewtoolkit.model.Identifier import org.ossreviewtoolkit.model.OrtResult @@ -35,7 +34,6 @@ import org.ossreviewtoolkit.model.config.RepositoryConfiguration import org.ossreviewtoolkit.model.config.ScopeExclude import org.ossreviewtoolkit.model.licenses.ResolvedLicense import org.ossreviewtoolkit.utils.common.zipWithCollections -import org.ossreviewtoolkit.utils.common.zipWithDefault import org.ossreviewtoolkit.utils.spdx.SpdxExpression fun Collection.containsUnresolved() = any { !it.isResolved } @@ -61,11 +59,6 @@ data class ReportTableModel( */ val issueSummary: IssueTable, - /** - * A [SummaryTable] containing the dependencies of all [Project]s. - */ - val summary: SummaryTable, - /** * The [ProjectTable]s containing the dependencies for each [Project]. */ @@ -149,60 +142,6 @@ data class ReportTableModel( val scanIssues: List ) - data class SummaryTable( - val rows: List - ) - - data class SummaryRow( - /** - * The identifier of the package. - */ - val id: Identifier, - - /** - * The scopes the package is used in, grouped by the [Identifier] of the [Project] they appear in. - */ - val scopes: SortedMap>>, - - /** - * The concluded licenses of the package. - */ - val concludedLicenses: Set, - - /** - * The licenses declared by the package. - */ - val declaredLicenses: Set, - - /** - * The detected licenses aggregated from all [ScanResult]s for this package. - */ - val detectedLicenses: SortedSet, - - /** - * All analyzer issues related to this package, grouped by the [Identifier] of the [Project] they appear in. - */ - val analyzerIssues: SortedMap>, - - /** - * All scan issues related to this package, grouped by the [Identifier] of the [Project] they appear in. - */ - val scanIssues: SortedMap> - ) { - fun merge(other: SummaryRow) = - SummaryRow( - id = id, - scopes = scopes.zipWithDefault(other.scopes, sortedMapOf()) { left, right -> - left.zipWithCollections(right).toSortedMap() - }.toSortedMap(), - concludedLicenses = concludedLicenses + other.concludedLicenses, - declaredLicenses = declaredLicenses + other.declaredLicenses, - detectedLicenses = (detectedLicenses + other.detectedLicenses).toSortedSet(), - analyzerIssues = analyzerIssues.zipWithCollections(other.analyzerIssues).toSortedMap(), - scanIssues = scanIssues.zipWithCollections(other.scanIssues).toSortedMap() - ) - } - data class IssueTable( val rows: List ) { diff --git a/reporter/src/main/kotlin/ReportTableModelMapper.kt b/reporter/src/main/kotlin/ReportTableModelMapper.kt index bf53ca61f64d8..415c22e6aecf3 100644 --- a/reporter/src/main/kotlin/ReportTableModelMapper.kt +++ b/reporter/src/main/kotlin/ReportTableModelMapper.kt @@ -38,8 +38,6 @@ import org.ossreviewtoolkit.reporter.ReportTableModel.IssueTable import org.ossreviewtoolkit.reporter.ReportTableModel.ProjectTable import org.ossreviewtoolkit.reporter.ReportTableModel.ResolvableIssue import org.ossreviewtoolkit.reporter.ReportTableModel.ResolvableViolation -import org.ossreviewtoolkit.reporter.ReportTableModel.SummaryRow -import org.ossreviewtoolkit.reporter.ReportTableModel.SummaryTable /** * A mapper which converts an [OrtResult] to a [ReportTableModel]. @@ -52,7 +50,6 @@ object ReportTableModelMapper { howToFixTextProvider: HowToFixTextProvider ): ReportTableModel { val issueSummaryRows = mutableMapOf() - val summaryRows = mutableMapOf() val analyzerResult = ortResult.analyzer?.result val excludes = ortResult.getExcludes() @@ -104,30 +101,6 @@ object ReportTableModelMapper { ) val isRowExcluded = ortResult.isExcluded(row.id) - - val nonExcludedAnalyzerIssues = if (isRowExcluded) emptyList() else row.analyzerIssues - val nonExcludedScanIssues = if (isRowExcluded) emptyList() else row.scanIssues - - val summaryRow = SummaryRow( - id = row.id, - scopes = sortedMapOf(project.id to row.scopes), - concludedLicenses = row.concludedLicense?.let { setOf(it) }.orEmpty(), - declaredLicenses = row.declaredLicenses.mapTo(mutableSetOf()) { it.license.toString() }, - detectedLicenses = row.detectedLicenses.mapTo(sortedSetOf()) { it.license.toString() }, - analyzerIssues = if (nonExcludedAnalyzerIssues.isNotEmpty()) { - sortedMapOf(project.id to nonExcludedAnalyzerIssues) - } else { - sortedMapOf() - }, - scanIssues = if (nonExcludedScanIssues.isNotEmpty()) { - sortedMapOf(project.id to nonExcludedScanIssues) - } else { - sortedMapOf() - } - ) - - summaryRows[row.id] = summaryRows[row.id]?.merge(summaryRow) ?: summaryRow - val unresolvedAnalyzerIssues = row.analyzerIssues.filterUnresolved() val unresolvedScanIssues = row.scanIssues.filterUnresolved() @@ -163,11 +136,6 @@ object ReportTableModelMapper { val issueSummaryTable = IssueTable(issueSummaryRows.values.sortedBy { it.id }) - val summaryTable = SummaryTable( - // Sort excluded rows to the end of the list. - summaryRows.values.sortedWith(compareBy({ ortResult.isExcluded(it.id) }, { it.id })) - ) - // TODO: Use the prefixes up until the first '.' (which below get discarded) for some visual grouping in the // report. val labels = ortResult.labels.mapKeys { it.key.substringAfter(".") } @@ -181,7 +149,6 @@ object ReportTableModelMapper { ortResult.repository.config, ruleViolations, issueSummaryTable, - summaryTable, projectTables, labels )