Skip to content

Commit 3bc2f50

Browse files
FabianRolfMatthiasNollfviernau
authored andcommitted
feat(cli-helper): Add support for authors in package-list.yml
Currently, the `package-list.yml` format does not support specifying authors for dependencies. This limits the completeness of the analyzer result generated from such lists. Add an `authors` field to the `Dependency` data class and map it to the `Package` object in `CreateAnalyzerResultFromPackageListCommand`. This allows users to define authors in their package lists, which are then included in the generated analyzer result. Signed-off-by: Fabian Noll <Fabian.Noll@googlemail.com>
1 parent 58443a3 commit 3bc2f50

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

cli-helper/src/funTest/resources/create-analyzer-result-from-pkg-list-expected-output.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ analyzer:
8686
path: "vcs-path/dependency-one"
8787
- id: "NPM::example-dependency-two:2.0.0"
8888
purl: "pkg:github/example-org/example-dependency-two@v2.0.0"
89+
authors:
90+
- "Author One"
91+
- "Author Two"
8992
declared_licenses: []
9093
declared_licenses_processed: {}
9194
concluded_license: "MIT-Festival"

cli-helper/src/funTest/resources/package-list.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ dependencies:
3131
concludedLicense: "MIT-Festival"
3232
description: "Package description."
3333
homepageUrl: "https://example.com/example-dependency-two"
34+
authors:
35+
- "Author One"
36+
- "Author Two"
3437
isExcluded: false
3538
isDynamicallyLinked: false
3639
labels:

cli-helper/src/main/kotlin/commands/CreateAnalyzerResultFromPackageListCommand.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ private data class Dependency(
155155
val concludedLicense: SpdxExpression? = null,
156156
val description: String? = null,
157157
val homepageUrl: String? = null,
158+
val authors: Set<String> = emptySet(),
158159
val isExcluded: Boolean = false,
159160
val isDynamicallyLinked: Boolean = false,
160161
val labels: Map<String, String> = emptyMap()
@@ -201,6 +202,7 @@ private fun Dependency.toPackage(): Package {
201202
return Package(
202203
id = id,
203204
purl = purl ?: id.toPurl(),
205+
authors = authors,
204206
sourceArtifact = sourceArtifact?.let { RemoteArtifact(url = it.url, it.hash ?: Hash.NONE) }.orEmpty(),
205207
vcs = vcsInfo,
206208
declaredLicenses = declaredLicenses,

0 commit comments

Comments
 (0)