Skip to content

Commit

Permalink
refactor: Update as KnownProvenance casts
Browse files Browse the repository at this point in the history
In some instances, the casting to `KnownProvenance` is not
explicitly required by receiving functions, here a more
strict casting to `RemoteProvenance` is cleaner.

Signed-off-by: Jens Keim <jens.keim@forvia.com>
  • Loading branch information
pepper-jk committed Nov 26, 2024
1 parent 78e4be6 commit 2d70747
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions helper-cli/src/main/kotlin/utils/Extensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ internal fun OrtResult.getViolatedRulesByLicense(
/**
* Return the [Provenance] of the first scan result matching the given [id] or null if there is no match.
*/
internal fun OrtResult.getScannedProvenance(id: Identifier): KnownProvenance? =
getScanResultsForId(id).firstNotNullOfOrNull { it.provenance as? KnownProvenance }
internal fun OrtResult.getScannedProvenance(id: Identifier): RemoteProvenance? =
getScanResultsForId(id).firstNotNullOfOrNull { it.provenance as? RemoteProvenance }

/**
* Return the [SourceCodeOrigin] for this provenance.
Expand Down
4 changes: 2 additions & 2 deletions model/src/main/kotlin/ScannerRun.kt
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ data class ScannerRun(
provenances.associateBy { it.id }
}

private val scanResultsByProvenance: Map<KnownProvenance, List<ScanResult>> by lazy {
scanResults.groupBy { it.provenance as KnownProvenance }
private val scanResultsByProvenance: Map<RemoteProvenance, List<ScanResult>> by lazy {
scanResults.groupBy { it.provenance as RemoteProvenance }
}

private val scanResultsById: Map<Identifier, List<ScanResult>> by lazy {
Expand Down

0 comments on commit 2d70747

Please sign in to comment.