-
Notifications
You must be signed in to change notification settings - Fork 314
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(model)!: Simplify the CuratedPackage
and its creation
#9679
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9679 +/- ##
=========================================
Coverage 68.10% 68.10%
Complexity 1294 1294
=========================================
Files 249 249
Lines 8841 8841
Branches 922 922
=========================================
Hits 6021 6021
Misses 2432 2432
Partials 388 388
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
7036c4c
to
944542c
Compare
@@ -20,7 +20,7 @@ | |||
package org.ossreviewtoolkit.model | |||
|
|||
/** | |||
* A [Package] including the [PackageCurationResult]s that were applied to it, in order to be able to trace back how the | |||
* A [Package] including the [PackageCuration]s that were applied to it, in order to be able to trace back how the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically, the PR looks sensible to me. However, the PackageCurationResult
class should be removed completely now as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commit message:
- "results containd entries"
- "in particular the value
s" - "original value
s" - Comma before "had been useful"
- "ORT result ha
sve been refactored" - To avoid multiple "So, " sentences:
- "So, that the serialized ORT result" -> "This means that the serialized ORT result"
- "So, the
base
property is not needed anymore." -> "That is why ..."
- "Remove the
base
property, to also remove thediff()
function, which
is only needed for computing thebase
." -> "So, remove thebase
property, which allows to also remove thediff()
function as that was only needed to compute thebase
." - I'd just drop "In particular when
Map
s are in play.". - "It may may" -> "It may make"
- Do not put "property" into backticks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"...including the [PackageCurationData] that was applied to it..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not required for this PR, but looking at this class now I wonder if we should also change the metadata
property of this class to contain the raw metadata of the package and add a helper function to get the package with applied curations instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not required for this PR,
I thought about this too. (Also thought it could be a follow up), had basically similar idea in mind.
@@ -68,7 +69,7 @@ data class ConcludedLicenseInfo( | |||
/** | |||
* The list of [PackageCurationResult]s that modified the concluded license. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still referencing old PackageCurationResult
.
@@ -93,7 +94,7 @@ data class DeclaredLicenseInfo( | |||
/** | |||
* The list of [PackageCurationResult]s that modified the declared license. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still referencing old PackageCurationResult
.
@@ -20,7 +20,7 @@ | |||
package org.ossreviewtoolkit.model | |||
|
|||
/** | |||
* A [Package] including the [PackageCurationResult]s that were applied to it, in order to be able to trace back how the | |||
* A [Package] including the [PackageCuration]s that were applied to it, in order to be able to trace back how the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"...including the [PackageCurationData] that was applied to it..."
@@ -20,7 +20,7 @@ | |||
package org.ossreviewtoolkit.model | |||
|
|||
/** | |||
* A [Package] including the [PackageCurationResult]s that were applied to it, in order to be able to trace back how the | |||
* A [Package] including the [PackageCuration]s that were applied to it, in order to be able to trace back how the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not required for this PR, but looking at this class now I wonder if we should also change the metadata
property of this class to contain the raw metadata of the package and add a helper function to get the package with applied curations instead.
Historically, serialized ORT results contained entries for all `CuratedPackage`s. Back then, the list of `PackageCurationResult`, in particular the value of the `base` property, had been useful to trace back from which original value any curated package had been derived. Meanwhile, ORT results have been refactored to apply the package curations on-the-fly. This means that the serialized ORT result only contains the original, non-curated packages and the package curations separately, but no more the curated packages. So, in order to debug the derivation one can simply use break points in the function which applies the curation. That is why the `base` property is not needed anymore. So, remove the `base` property, which allows to also remove the `diff()` function as it was only needed to compute the `base`. This simplifies things, because the `diff` is not always straight forward to compute and make sense of. Note: It might make sense to add the `original` package as a separate property to `CuratedPackage`. Signed-off-by: Frank Viernau <[email protected]> Signed-off-by: Sebastian Schuberth <[email protected]>
944542c
to
e83a95b
Compare
Thank you @sschuberth , @mnonnenmacher for moving this forward :-) |
Historically, serialized ORT results contain entries for all
CuratedPackage
s. Back then, the list ofPackageCurationResult
, in particular the values of thebase
property had been useful to trace back from which original values any curated package had been derived.Meanwhile, ORT result has been refactored to apply the package curations on-the-fly. So, that the serialized ORT result only contains the original, non-curated packages and the package curations separately, but no more the curated packages. So, in order to debug the derivation one can simply use break points in the function which applies the curation. So, the
base
property is not needed anymore.Remove the
base
property, to also remove thediff()
function, which is only needed for computing thebase
. This simplifies things, because thediff
is not always straight forward to compute and make sense of. In particular whenMap
s are in play.Note: It may may sense to add the
original
package as a separateproperty
toCuratedPackage
.Related to: #8725.