Skip to content

Commit

Permalink
refactor: Adjust KnownProvenance conditional cases
Browse files Browse the repository at this point in the history
Functions accepting a `KnownProvenance` often only
handle the two explicit cases of `Artifact` or
`RepositoryProvenance`.
Add `else` cases to conditional `when`s.

All conditional cases of `Artifact` and `RepositoryProvenance`
following after `KnownProvenance` as a parameter type were
investigated by the same methods as the previous commits.

Signed-off-by: Jens Keim <jens.keim@forvia.com>
  • Loading branch information
pepper-jk committed Nov 27, 2024
1 parent b272f33 commit e67dac2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions model/src/main/kotlin/config/PackageConfiguration.kt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ data class PackageConfiguration(
is UnknownProvenance -> false
is ArtifactProvenance -> sourceArtifactUrl != null && sourceArtifactUrl == provenance.sourceArtifact.url
is RepositoryProvenance -> vcs != null && vcs.matches(provenance)
else -> false

Check warning on line 80 in model/src/main/kotlin/config/PackageConfiguration.kt

View check run for this annotation

Codecov / codecov/patch

model/src/main/kotlin/config/PackageConfiguration.kt#L80

Added line #L80 was not covered by tests
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions model/src/main/kotlin/utils/PurlExtensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ fun Provenance.toPurlExtras(): PurlExtras =
}

is UnknownProvenance -> PurlExtras()

else -> PurlExtras()
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class DefaultNestedProvenanceResolver(
return when (provenance) {
is ArtifactProvenance -> NestedProvenance(root = provenance, subRepositories = emptyMap())
is RepositoryProvenance -> resolveNestedRepository(provenance)
else -> NestedProvenance(root = provenance, subRepositories = emptyMap())

Check warning on line 53 in scanner/src/main/kotlin/provenance/NestedProvenanceResolver.kt

View check run for this annotation

Codecov / codecov/patch

scanner/src/main/kotlin/provenance/NestedProvenanceResolver.kt#L53

Added line #L53 was not covered by tests
}
}

Expand Down

0 comments on commit e67dac2

Please sign in to comment.