-
Notifications
You must be signed in to change notification settings - Fork 363
feat(model): Add Snippet additionalData #7022
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(model): Add Snippet additionalData #7022
Conversation
| internal val SERVER_URL_KEY = "serverurl" | ||
|
|
||
| @JvmStatic | ||
| internal val PROJECT_REVISION_LABEL = "projectVcsRevision" |
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-msg: Please explain why the added data is needed. E.g. what are the use cases?
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #7022 +/- ##
============================================
+ Coverage 64.28% 64.30% +0.01%
Complexity 1976 1976
============================================
Files 332 332
Lines 16734 16744 +10
Branches 2382 2383 +1
============================================
+ Hits 10758 10767 +9
Misses 4937 4937
- Partials 1039 1040 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
7b1d764 to
14ccf85
Compare
Unfortunately id does not:
|
My concerns were only about the use of the custom data, but no use is introduced in this PR.
| * be made available in the scan Summary. | ||
| */ | ||
| @JsonInclude(JsonInclude.Include.NON_EMPTY) | ||
| val additionalData: Map<String, String> = emptyMap() |
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.
It just occurred to me that we already have additionalData in ScanResult. So do we really need this at this place?
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.
I took inspiration of ScanResult.additionalData 😃
Yes we need it at the snippet level, to carry snippet specific data such as the ID.
How would you put this information in the additionalData of ScanResult ?
Knowing it's a Map<String, String> and you can't have structured data in 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.
Knowing it's a
Map<String, String>and you can't have structured data in it ?
Well you could (e.g. by applying a naming convention), but on a second thought I agree it's not very feasible.
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 strictly related to this PR, but it also just occurred to me that the SnippetFinding class is located in the utils package. Unless there's a good reason for that, I'd prefer it to go along the LicenseFinding and CopyrightFinding classes in the root model package. Could you mind adding a preceding commit to this PR that addressed that?
|
|
||
| /** | ||
| * A map for scanner specific snippet data that cannot be mapped into any generalized property, but still needs to | ||
| * be made available in the scan Summary. |
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.
This should say "scan summary" or "[ScanSummary]".
14ccf85 to
3aa7ce6
Compare
| package org.ossreviewtoolkit.model | ||
|
|
||
| import org.ossreviewtoolkit.model.TextLocation | ||
| import org.ossreviewtoolkit.model.utils.Snippet |
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.
Argh, sorry, IMO Snippet should be moved as well, as it's not a utility to work on model classes, but a model class itself.
3aa7ce6 to
52952c1
Compare
52952c1 to
22c1541
Compare
| */ | ||
|
|
||
| package org.ossreviewtoolkit.model.utils | ||
| package org.ossreviewtoolkit.model |
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 nit: The breaking api change should be indicated by an exclamation mark: "fix(model)!: ..."
This allows to align with `LicenseFinding` and `CopyrightFinding`. Signed-off-by: Nicolas Nobelis <[email protected]>
Some scanner-specific snippet information is not captured by the current snippet model. For instance, FossId delivers an id for each snippet. This commit adds a new property `additionalData` in the `Snippet` class to store this information. Signed-off-by: Nicolas Nobelis <[email protected]>
This information will be accessed in a future commit to fill a FossID snippet report which will be added to ORT. Additionally, the `id` will be used to fetch the matched lines of a snippet using the function `FossIdRestService.listMatchedLines`. Signed-off-by: Nicolas Nobelis <[email protected]>
22c1541 to
d00f658
Compare
Please have a look at the individual commit messages for the details.