Skip to content

Commit

Permalink
chore(spdx-reporter): Simplify licenseDeclared expressions
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Schuberth <[email protected]>
  • Loading branch information
sschuberth committed Nov 5, 2024
1 parent 9a60ffe commit 1201aba
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ packages:
filesAnalyzed: false
homepage: "NONE"
licenseConcluded: "NOASSERTION"
licenseDeclared: "Apache-2.0 AND MIT AND MIT"
licenseDeclared: "Apache-2.0 AND MIT"
name: "gopkg.in/yaml.v3"
summary: "NONE"
versionInfo: "3.0.1"
Expand All @@ -288,7 +288,7 @@ packages:
filesAnalyzed: false
homepage: "NONE"
licenseConcluded: "NOASSERTION"
licenseDeclared: "Apache-2.0 AND MIT AND MIT"
licenseDeclared: "Apache-2.0 AND MIT"
name: "gopkg.in/yaml.v3"
summary: "NONE"
versionInfo: "3.0.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"filesAnalyzed" : false,
"homepage" : "first package's homepage URL",
"licenseConcluded" : "BSD-2-Clause AND BSD-3-Clause AND MIT",
"licenseDeclared" : "Apache-2.0 AND BSD-2-Clause AND BSD-2-Clause AND BSD-2-Clause AND BSD-2-Clause AND BSD-3-Clause AND BSD-3-Clause AND BSD-3-Clause AND BSD-3-Clause AND BSD-3-Clause AND BSD-3-Clause AND (GPL-2.0-only OR MIT) AND (GPL-2.0-only OR MIT) AND (GPL-2.0-only OR MIT) AND MIT AND MIT AND MIT",
"licenseDeclared" : "Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND (GPL-2.0-only OR MIT) AND MIT",
"name" : "first-package",
"summary" : "A package with all supported attributes set, with a VCS URL containing a user name, and with two scan results for the VCS containing copyright findings matched to a license finding.",
"versionInfo" : "0.0.1"
Expand All @@ -63,7 +63,7 @@
"hasFiles" : [ "SPDXRef-File-1" ],
"homepage" : "first package's homepage URL",
"licenseConcluded" : "NOASSERTION",
"licenseDeclared" : "Apache-2.0 AND BSD-2-Clause AND BSD-2-Clause AND BSD-2-Clause AND BSD-2-Clause AND BSD-3-Clause AND BSD-3-Clause AND BSD-3-Clause AND BSD-3-Clause AND BSD-3-Clause AND BSD-3-Clause AND (GPL-2.0-only OR MIT) AND (GPL-2.0-only OR MIT) AND (GPL-2.0-only OR MIT) AND MIT AND MIT AND MIT",
"licenseDeclared" : "Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND (GPL-2.0-only OR MIT) AND MIT",
"licenseInfoFromFiles" : [ "Apache-2.0", "BSD-2-Clause" ],
"name" : "first-package",
"packageVerificationCode" : {
Expand All @@ -87,7 +87,7 @@
"filesAnalyzed" : false,
"homepage" : "first package's homepage URL",
"licenseConcluded" : "NOASSERTION",
"licenseDeclared" : "Apache-2.0 AND BSD-2-Clause AND BSD-2-Clause AND BSD-2-Clause AND BSD-2-Clause AND BSD-3-Clause AND BSD-3-Clause AND BSD-3-Clause AND BSD-3-Clause AND BSD-3-Clause AND BSD-3-Clause AND (GPL-2.0-only OR MIT) AND (GPL-2.0-only OR MIT) AND (GPL-2.0-only OR MIT) AND MIT AND MIT AND MIT",
"licenseDeclared" : "Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND (GPL-2.0-only OR MIT) AND MIT",
"name" : "first-package",
"summary" : "A package with all supported attributes set, with a VCS URL containing a user name, and with two scan results for the VCS containing copyright findings matched to a license finding.",
"versionInfo" : "0.0.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,8 @@ packages:
filesAnalyzed: false
homepage: "first package's homepage URL"
licenseConcluded: "BSD-2-Clause AND BSD-3-Clause AND MIT"
licenseDeclared: "Apache-2.0 AND BSD-2-Clause AND BSD-2-Clause AND BSD-2-Clause\
\ AND BSD-2-Clause AND BSD-3-Clause AND BSD-3-Clause AND BSD-3-Clause AND BSD-3-Clause\
\ AND BSD-3-Clause AND BSD-3-Clause AND (GPL-2.0-only OR MIT) AND (GPL-2.0-only\
\ OR MIT) AND (GPL-2.0-only OR MIT) AND MIT AND MIT AND MIT"
licenseDeclared: "Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND (GPL-2.0-only\
\ OR MIT) AND MIT"
name: "first-package"
summary: "A package with all supported attributes set, with a VCS URL containing\
\ a user name, and with two scan results for the VCS containing copyright findings\
Expand All @@ -78,10 +76,8 @@ packages:
- "SPDXRef-File-1"
homepage: "first package's homepage URL"
licenseConcluded: "NOASSERTION"
licenseDeclared: "Apache-2.0 AND BSD-2-Clause AND BSD-2-Clause AND BSD-2-Clause\
\ AND BSD-2-Clause AND BSD-3-Clause AND BSD-3-Clause AND BSD-3-Clause AND BSD-3-Clause\
\ AND BSD-3-Clause AND BSD-3-Clause AND (GPL-2.0-only OR MIT) AND (GPL-2.0-only\
\ OR MIT) AND (GPL-2.0-only OR MIT) AND MIT AND MIT AND MIT"
licenseDeclared: "Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND (GPL-2.0-only\
\ OR MIT) AND MIT"
licenseInfoFromFiles:
- "Apache-2.0"
- "BSD-2-Clause"
Expand All @@ -107,10 +103,8 @@ packages:
filesAnalyzed: false
homepage: "first package's homepage URL"
licenseConcluded: "NOASSERTION"
licenseDeclared: "Apache-2.0 AND BSD-2-Clause AND BSD-2-Clause AND BSD-2-Clause\
\ AND BSD-2-Clause AND BSD-3-Clause AND BSD-3-Clause AND BSD-3-Clause AND BSD-3-Clause\
\ AND BSD-3-Clause AND BSD-3-Clause AND (GPL-2.0-only OR MIT) AND (GPL-2.0-only\
\ OR MIT) AND (GPL-2.0-only OR MIT) AND MIT AND MIT AND MIT"
licenseDeclared: "Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND (GPL-2.0-only\
\ OR MIT) AND MIT"
name: "first-package"
summary: "A package with all supported attributes set, with a VCS URL containing\
\ a user name, and with two scan results for the VCS containing copyright findings\
Expand Down
1 change: 1 addition & 0 deletions plugins/reporters/spdx/src/main/kotlin/Extensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ internal fun Package.toSpdxPackage(
SpdxConstants.NONE
} else {
packageLicenseExpressions.reduce(SpdxExpression::and)
.simplify()
.sorted()
.nullOrBlankToSpdxNoassertionOrNone()
},
Expand Down

0 comments on commit 1201aba

Please sign in to comment.