Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Provenance): Add RemoteProvenance sub interface #9476

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: Update as KnownProvenance casts
In some instances, the casting to `KnownProvenance` is not
explicitly required by receiving functions, here a more
strict casting to `RemoteProvenance` is cleaner.

All cases of `KnownProvenance` as a cast type were investigated
by the same methods as the previous commit.

Signed-off-by: Jens Keim <[email protected]>
pepper-jk committed Jan 29, 2025

Verified

This commit was signed with the committer’s verified signature.
nursoda Olav Seyfarth
commit 4acb1d6b1929ee8433bdce0d1fe7e847cbc8b045
4 changes: 2 additions & 2 deletions helper-cli/src/main/kotlin/utils/Extensions.kt
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 2 additions & 2 deletions model/src/main/kotlin/ScannerRun.kt
Original file line number Diff line number Diff line change
@@ -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 {