Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 7a6f396

Browse files
committedNov 26, 2024··
refactor: Adjust KnownProvenance conditional cases
Functions accepting a `KnownProvenance` often only handle the two explicit cases of `Artifact` or `RepositoryProvenance`. Add `else` cases to conditional `when`s. Signed-off-by: Jens Keim <[email protected]>
1 parent 2d70747 commit 7a6f396

File tree

4 files changed

+5
-0
lines changed

4 files changed

+5
-0
lines changed
 

‎model/src/main/kotlin/config/PackageConfiguration.kt

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ data class PackageConfiguration(
7777
is UnknownProvenance -> false
7878
is ArtifactProvenance -> sourceArtifactUrl != null && sourceArtifactUrl == provenance.sourceArtifact.url
7979
is RepositoryProvenance -> vcs != null && vcs.matches(provenance)
80+
else -> false
8081
}
8182
}
8283
}

‎model/src/main/kotlin/licenses/LicenseInfoResolver.kt

+1
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ class LicenseInfoResolver(
265265
when (provenance) {
266266
is UnknownProvenance -> return@forEach
267267
is RemoteProvenance -> if (!archiver.unarchive(archiveDir, provenance)) return@forEach
268+
else -> return@forEach
268269
}
269270

270271
val directory = (provenance as? RepositoryProvenance)?.vcsInfo?.path.orEmpty()

‎model/src/main/kotlin/utils/PurlExtensions.kt

+2
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ fun Provenance.toPurlExtras(): PurlExtras =
106106
}
107107

108108
is UnknownProvenance -> PurlExtras()
109+
110+
else -> PurlExtras()
109111
}
110112

111113
/**

‎scanner/src/main/kotlin/provenance/NestedProvenanceResolver.kt

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class DefaultNestedProvenanceResolver(
5050
return when (provenance) {
5151
is ArtifactProvenance -> NestedProvenance(root = provenance, subRepositories = emptyMap())
5252
is RepositoryProvenance -> resolveNestedRepository(provenance)
53+
else -> NestedProvenance(root = provenance, subRepositories = emptyMap())
5354
}
5455
}
5556

0 commit comments

Comments
 (0)
Please sign in to comment.