Skip to content

Commit

Permalink
feat(evaluated-model): Re-filter scan summary by VCS path
Browse files Browse the repository at this point in the history
Analog to [1], re-filter all scan results by VCS path, so that the
effect of narrowing down a VCS path via a package curation is reflected
in the evaluated model (and WebApp).

[1]: 2ec49c7

Signed-off-by: Frank Viernau <frank_viernau@epam.com>
  • Loading branch information
fviernau committed May 29, 2024
1 parent 4342001 commit 230beec
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import org.ossreviewtoolkit.model.toYaml
import org.ossreviewtoolkit.model.utils.FindingCurationMatcher
import org.ossreviewtoolkit.model.utils.FindingsMatcher
import org.ossreviewtoolkit.model.utils.RootLicenseMatcher
import org.ossreviewtoolkit.model.utils.filterByVcsPath
import org.ossreviewtoolkit.model.vulnerabilities.Vulnerability
import org.ossreviewtoolkit.reporter.ReporterInput
import org.ossreviewtoolkit.reporter.StatisticsCalculator.getStatistics
Expand Down Expand Up @@ -411,6 +412,12 @@ internal class EvaluatedModelMapper(private val input: ReporterInput) {
findings: MutableList<EvaluatedFinding>
): List<EvaluatedScanResult> =
input.ortResult.getScanResultsForId(pkg.id).map { scanResult ->
// If a VCS path curation has been applied after the scanning stage, it is possible to apply that curation
// without re-scanning in case the new VCS path is a subdirectory of the scanned VCS path. So, filter by VCS
// path to enable the user to see the effect on the detected license with a shorter turn around time /
// without re-scanning.
scanResult.filterByVcsPath(input.ortResult.getPackage(pkg.id)?.metadata?.vcsProcessed?.path.orEmpty())
}.map { scanResult ->
convertScanResult(scanResult, findings, pkg)
}

Expand Down

0 comments on commit 230beec

Please sign in to comment.