-
Couldn't load subscription status.
- Fork 356
feat(reporter): Implement the FossID snippet reporter #7127
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(reporter): Implement the FossID snippet reporter #7127
Conversation
plugins/reporters/fossid-snippets/src/main/kotlin/FossIdSnippetReporter.kt
Fixed
Show fixed
Hide fixed
Codecov ReportPatch and project coverage have no change.
Additional details and impacted files@@ Coverage Diff @@
## main #7127 +/- ##
=========================================
Coverage 64.27% 64.27%
Complexity 1970 1970
=========================================
Files 333 333
Lines 16667 16667
Branches 2389 2389
=========================================
Hits 10713 10713
Misses 4912 4912
Partials 1042 1042
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
e3bc159 to
c377a4c
Compare
plugins/reporters/fossid-snippets/src/main/kotlin/FossIdSnippetReporter.kt
Fixed
Show fixed
Hide fixed
plugins/reporters/fossid-snippets/src/main/kotlin/FossIdSnippetReporter.kt
Outdated
Show resolved
Hide resolved
plugins/reporters/fossid-snippets/src/main/kotlin/FossIdSnippetReporter.kt
Outdated
Show resolved
Hide resolved
plugins/reporters/fossid-snippets/src/main/kotlin/FossIdSnippetReporter.kt
Show resolved
Hide resolved
plugins/reporters/fossid-snippets/src/main/resources/templates/asciidoc/fossid_snippets.ftl
Outdated
Show resolved
Hide resolved
plugins/reporters/freemarker/src/main/kotlin/FreemarkerTemplateProcessor.kt
Outdated
Show resolved
Hide resolved
plugins/reporters/fossid-snippets/src/main/resources/templates/asciidoc/fossid_snippets.ftl
Outdated
Show resolved
Hide resolved
c377a4c to
9c4569b
Compare
| * not support support VCS path, they are most likely duplicates of other results. | ||
| */ | ||
| @Suppress("UNUSED") // This function is used in the templates. | ||
| fun filterResultsByVCS(scanResults: Map<Identifier, List<ScanResult>>): Map<Identifier, List<ScanResult>> { |
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.
Shouldn't this filtering already happen in the FossID scanner implementation, so such results do not show up in the first 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.
Hmm I will try to better explain: the project I am scanning contains two packages with the same provenance, differing in the VCS path.
The current scanner logic in ORT sees that these packages have the same provenance, and triggers a scan for one of them in FossID ("Which one" could be influenced thanks to #7092).
Then, after the scan, there is a scanner logic that de duplicates the scan results for packages with the same provenance. Therefore the scan results contains the FossID results two times, one for each package.
Therefore there is no filtering to be done in FossID : the scanner scans already only one package.
I think the whole duplication behavior will be fixed when FossID will scan by provenance and that scan results are stored by provenance.
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.
there is a scanner logic that de duplicates the scan results for packages with the same provenance
Did you mean "duplicates" instead of "de duplicates"? (I believe duplicating is what it actually does)
Therefore there is no filtering to be done in FossID : the scanner scans already only one package.
I don't understand how the amount of packages being scanned is related to filtering findings by path.
To me these topics seem unrelated, maybe there is a mis-understanding here.
I believe it'd be worth looking at the functions ScanSummary.filterByPath() and ScanSummary.filterByIgnorePatterns(). These do not adhere to snippet findings yet. I believe they need to be extended, which IIUC would address @sschuberth 's ask.
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.
Did you mean "duplicates" instead of "de duplicates"? (I believe duplicating is what it actually does)
Yes duplicate, sorry.
I don't understand how the amount of packages being scanned is related to filtering findings by path. To me these topics seem unrelated, maybe there is a mis-understanding here.
As I explained, the scan result of FossID are duplicated in the scan-results of ORT, because I have two packages with the same VCS root.
scan_results:
'pkg1':
- provenance:
vcs_info:
type: "Git"
path: "apath"
summary:
[...]
'pkg2':
- provenance:
vcs_info:
type: "Git"
path: ""
summary:
[...]
The two summaries are exactly the same, because they have been duplicated. Hence, I cannot just pass the scan_results to the reporter, otherwise I will see duplicated packages.
Therefore I need to filter the scan results to keep only one. I do it by VCS path, because I know FossID doesn't support it, but it could be any other criteria.
I believe it'd be worth looking at the functions
ScanSummary.filterByPath()andScanSummary.filterByIgnorePatterns(). These do not adhere to snippet findings yet. I believe they need to be extended, which IIUC would address @sschuberth 's ask.
Yes, but filterByPath filters the results to keep the ones under path. But it will not work here, because I have two packages with the same provenance.
Same for filterByIgnorePatterns I wouldn't know which ignore pattern to put, because once again these are two packages with the same provenance.
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.
The two summaries are exactly the same, because they have been duplicated. Hence, I cannot just pass the scan_results to the reporter, otherwise I will see duplicated packages.
I believe I still don't understand the case. Am I right that the ORT File / analyzer result contains two packages with identical provenance? ...and for both packages the same snippet is found?
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.
In the Analyzer result, there are two packages with nearly the same provenance: it only differs by vcs_info/path.
When the scanner is called, one package is chosen (=reference package) and scanned with FossID. The other package is NOT scanned. I believe this logic scans the reference package:
ort/scanner/src/main/kotlin/Scanner.kt
Lines 291 to 297 in 40eb0f0
| if (packagesWithIncompleteScanResult.size > 1) { | |
| logger.info { | |
| val packageIds = packagesWithIncompleteScanResult.drop(1) | |
| .joinToString("\n") { "\t${it.id.toCoordinates()}" } | |
| "Scanning package '${referencePackage.id.toCoordinates()}' as reference for these packages " + | |
| "with the same provenance:\n$packageIds" | |
| } |
Then after the scan, the ScanSummary of the reference package is duplicated to the other package.
At the end, the scan-results contains the two packages having each identical summaries.
The reporter cannot be called on this as the two duplicated summaries are the same. Therefore, this function filters the packages in the scan-results to keep only one.
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.
The reporter cannot be called on this as the two duplicated summaries are the same. Therefore, this function filters the packages in the scan-results to keep only one.
Shouldn't each package have the snippet findings associated with it, no matter if there is another package which includes the same snippets? If both packages are built from same VCS, then adjusting these filterBy functions I mentioned earlier would take care of filtering out the snippets which are not relevant.
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.
But I don't want to filter out individual snippet findings: I want to have in the report only ONE set of snippet findings.
Therefore, I need to do filtering at package level to keep only one package.
How is the webapp reporter dealing with duplicated license findings with packages having the same VCS ?
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.
How is the webapp reporter dealing with duplicated license findings with packages having the same VCS ?
AFAIK, the WebApp / static HTML report do report the licenses per package. If two packages are built from same VCS, they still report per package.
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.
Following this discussion, I realized this change was controversial so I removed the related commit to not hinder the current PR. I will rework it and add it to a future separate PR.
Ugh, this contains results for files like |
Some more UI-things:
|
Please don't be shocked by these results: when one triggers a scan with FossID, the scan gets automatically an ignore rule for |
Yes this would be nice but I noticed the work you mentioned has been done for the
Yes this is already the case in my development branch. This PR does not contain the how-to-fix block will be added later. The attached file was just an example to justify the need for HTML.
Well I have not idea what the score unit is for FossID as it doesn't show it in the UI and it is undocumented. |
8fb435c to
ff57fa2
Compare
ff57fa2 to
d1f2a26
Compare
plugins/reporters/fossid-snippets/src/main/kotlin/FossIdSnippetReporter.kt
Fixed
Show fixed
Hide fixed
7ae3d20 to
396f741
Compare
396f741 to
d41b2a6
Compare
plugins/reporters/fossid/src/main/kotlin/FossIdSnippetReporter.kt
Outdated
Show resolved
Hide resolved
...reporters/fossid/src/main/resources/META-INF/services/org.ossreviewtoolkit.reporter.Reporter
Outdated
Show resolved
Hide resolved
d41b2a6 to
28525cd
Compare
28525cd to
dd39637
Compare
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.
LGTM now, but I'd prefer @MarcelBochtler or @mnonnenmacher to approve as they have more insights about the use of the report.
Signed-off-by: Nicolas Nobelis <[email protected]>
This is an HTML report to present the snippet findings. HTML format was chosen to be able to use AsciiDoc collapsible blocks [1] for how-to-fix hints. Such blocks will be added in a future commit. [1]: https://docs.asciidoctor.org/asciidoc/latest/blocks/collapsible/ Signed-off-by: Nicolas Nobelis <[email protected]>
dd39637 to
9559abf
Compare
|
@nnobelis I have rebase the PR to get rid of the failing tests which were fixed in another PR. |
Please have a look at the individual commit messages for the details.
Example report (with how-to-fix hints):
AsciiDoc_fossid_snippets.zip