-
Notifications
You must be signed in to change notification settings - Fork 310
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
refactor: More explicit Provenance Handling #9421
base: main
Are you sure you want to change the base?
Conversation
Change `KnownProvenance` conditionals to explicitly check for `RepositoryProvenance` and `ArtifactProvenance`. Signed-off-by: Jens Keim <[email protected]>
Ensure return value if `KnownProvenance` is neither `ArtifactProvenance` nor `RepositoryProvenance`. Signed-off-by: Jens Keim <[email protected]>
Use explicit `RepositoryProvenance` as root in `createNestedProvenance`. Signed-off-by: Jens Keim <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9421 +/- ##
============================================
- Coverage 68.09% 65.68% -2.41%
- Complexity 1291 1303 +12
============================================
Files 250 250
Lines 8814 9218 +404
Branches 916 1022 +106
============================================
+ Hits 6002 6055 +53
- Misses 2427 2767 +340
- Partials 385 396 +11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Functions accepting a `KnownProvenance` often only handle the two explicit cases of `Artifact` or `RepositoryProvenance`. Since changing the parameter type is not an option for them, the conditional `when`s are given an appropriate else case. Signed-off-by: Jens Keim <[email protected]>
I'm having a general problem with the argumentation here, as you seem to assume that whatever new entity may get added to |
The point of this PR is mainly to avoid touching the same conditional statement over and over again during the refactoring and keeping the PRs small and incremental.
Once I change the hierarchy I have to handle it. This PR attempts to front load some of this work. I know it is hard to review changes without the hierarchy and the later new classes present, but we talked about it enough and defined the hierarchy in theory that it should be possible. However, I see your reasoning to start with the hierarchy, if this first PR is not at all to your liking. But I would prefer stopping there and implementing the I would just like to avoid creating a large PR with all the changes over the course of 2 month only to start from scratch this time. |
Since
RepositoryProvenance
andArtifactProvenance
are bothKnownProvenance
, ORT's code base widely assumes the interface is synonymous with the classes.This however might change in light of the proposed provenance interface/class hierarchy.
To ensure Code, which expects
KnownProvenance
to be eitherRepositoryProvenance
orArtifactProvenance
, will still function as expected during refactoring, this PR aims to remove some of the ambiguity regardingKnownProvenance
, especially in conditional statements.Signed-off-by: Jens Keim [email protected]