Skip to content

Commit

Permalink
feat(reporter): Add snippet choice examples to the snippet report
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas Nobelis <[email protected]>
  • Loading branch information
nnobelis authored and sschuberth committed Feb 28, 2024
1 parent d319fa9 commit fbc6489
Showing 1 changed file with 42 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ License(s):
|===
| Source Location | pURL | License | File | URL | Score | Release Date

.${snippetCount}+|
.${snippetCount*2}+|
[#if helper.isFullFileLocation(sourceLocation)]
Full match
[#else]
Partial match +
${sourceLocation.startLine}-${sourceLocation.endLine}
${sourceLocation.startLine?c}-${sourceLocation.endLine?c}
[/#if]

[#list snippetFinding.snippets as snippet ]
Expand All @@ -94,6 +94,46 @@ ${sourceLocation.startLine}-${sourceLocation.endLine}
| ${snippet.purl!""}
| ${snippet.licenses!""} | ${snippetFilePath} | ${snippet.provenance.sourceArtifact.url!""}[URL]
| ${snippet.score!""} | ${snippet.additionalData["releaseDate"]}
6+a|
.Create a snippet choice for this snippet or mark it as false positive
[%collapsible]
====
Add the following lines to the *.ort.yml* file.

To **choose** this snippet:
[source,yaml]
--
package_snippet_choices:
- provenance:
url: "${scanResult.provenance.vcsInfo.url}"
choices:
- given:
source_location:
path: "${filePath}"
start_line: ${snippetFinding.sourceLocation.startLine?c}
end_line: ${snippetFinding.sourceLocation.endLine?c}
choice:
purl: "${snippet.purl!""}"
reason: "ORIGINAL_FINDING"
comment: "Explain why this snippet choice was made"
--
Or to mark this location has having ONLY **false positives snippets**:
[source,yaml]
--
package_snippet_choices:
- provenance:
url: "${scanResult.provenance.vcsInfo.url}"
choices:
- given:
source_location:
path: "${filePath}"
start_line: ${snippetFinding.sourceLocation.startLine?c}
end_line: ${snippetFinding.sourceLocation.endLine?c}
choice:
reason: "NO_RELEVANT_FINDING"
comment: "Explain why this location has only false positives snippets"
--
====
[/#list]
|===
[/#list]
Expand Down

0 comments on commit fbc6489

Please sign in to comment.