Skip to content

Commit f8b8fda

Browse files
committed
feat(scanoss): Add release date to snippet findings
Include releaseDate in snippetFindings additionalData and add a new column to display this information in generated reports. Signed-off-by: Agustin Isasmendi <[email protected]>
1 parent 998309b commit f8b8fda

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

plugins/reporters/scanoss/src/main/resources/templates/asciidoc/scanoss_snippet.ftl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ License(s):
7979
[#assign snippetCount = snippetFinding.snippets?size]
8080

8181
[width=100%]
82-
[cols="1,3,4,1"]
82+
[cols="1,3,4,1,2"]
8383
|===
84-
| Source Location | pURL | License | Score
84+
| Source Location | pURL | License | Score | Release Date
8585

8686
.${snippetCount*2}+|
8787
Partial match +
@@ -93,6 +93,7 @@ ${sourceLocation.startLine?c}-${sourceLocation.endLine?c}
9393
| ${snippet.purl!""}
9494
| ${snippet.license!""}
9595
| ${snippet.score!""}
96+
| ${snippet.additionalData['release_date']}
9697

9798
4+a|
9899
.Create a snippet choice for this snippet or mark it as false positive

plugins/scanners/scanoss/src/main/kotlin/ScanOssResultParser.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,14 @@ private fun getSnippets(details: ScanFileDetails): Set<Snippet> {
154154
val vcsInfo = VcsHost.parseUrl(url.takeUnless { it == "none" }.orEmpty())
155155
val provenance = RepositoryProvenance(vcsInfo, ".")
156156

157+
val additionalData = mapOf("release_date" to details.releaseDate)
158+
157159
return buildSet {
158160
purls.forEach { purl ->
159161
locations.forEach { snippetLocation ->
160162
val license = licenses.toExpression()?.sorted() ?: SpdxLicenseIdExpression(SpdxConstants.NOASSERTION)
161163

162-
add(Snippet(score, snippetLocation, provenance, purl, license))
164+
add(Snippet(score, snippetLocation, provenance, purl, license, additionalData))
163165
}
164166
}
165167
}

plugins/scanners/scanoss/src/test/kotlin/ScanOssResultParserTest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ class ScanOssResultParserTest : WordSpec({
125125
"."
126126
),
127127
"pkg:github/vdurmont/semver4j",
128-
SpdxExpression.parse("CC-BY-SA-2.0")
128+
SpdxExpression.parse("CC-BY-SA-2.0"),
129+
additionalData = mapOf("release_date" to "2019-09-13")
129130
)
130131
)
131132
)

plugins/scanners/scanoss/src/test/kotlin/ScanOssScannerDirectoryTest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ class ScanOssScannerDirectoryTest : StringSpec({
111111
VcsInfo(VcsType.GIT, "https://github.com/scanoss/ort.git", ""), "."
112112
),
113113
"pkg:github/scanoss/ort",
114-
SpdxExpression.parse("Apache-2.0")
114+
SpdxExpression.parse("Apache-2.0"),
115+
additionalData = mapOf("release_date" to "2021-03-18")
115116
)
116117
)
117118
)

0 commit comments

Comments
 (0)