Skip to content

Commit f0c4bdc

Browse files
committed
Review comments
1 parent f579aec commit f0c4bdc

3 files changed

Lines changed: 16 additions & 8 deletions

File tree

dfetch/commands/report.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def _determine_licenses(project: ProjectEntry) -> LicenseScanResult:
136136

137137
if (
138138
guessed_license
139-
and guessed_license.probability > LICENSE_PROBABILITY_THRESHOLD
139+
and guessed_license.probability >= LICENSE_PROBABILITY_THRESHOLD
140140
):
141141
identified.append(guessed_license)
142142
else:

dfetch/reporting/sbom_reporter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
)
132132
from cyclonedx.model.contact import OrganizationalEntity
133133
from cyclonedx.model.license import DisjunctiveLicense as CycloneDxLicense
134-
from cyclonedx.model.license import LicenseAcknowledgement, LicenseExpression
134+
from cyclonedx.model.license import LicenseAcknowledgement
135135
from cyclonedx.output import make_outputter
136136
from cyclonedx.schema import OutputFormat, SchemaVersion
137137
from packageurl import PackageURL
@@ -408,7 +408,7 @@ def _apply_licenses(component: Component, license_scan: LicenseScanResult) -> No
408408
component.evidence.licenses.add(cdx_license)
409409
# Record per-license confidence so auditors can compare against
410410
# the threshold and re-evaluate if the threshold changes.
411-
label = lic.spdx_id or lic.name
411+
label = lic.spdx_id or lic.name or "unknown"
412412
component.properties.add(
413413
Property(
414414
name=f"dfetch:license:{label}:confidence",
@@ -417,7 +417,7 @@ def _apply_licenses(component: Component, license_scan: LicenseScanResult) -> No
417417
)
418418
return
419419

420-
noassertion = LicenseExpression("NOASSERTION")
420+
noassertion = CycloneDxLicense(name="NOASSERTION")
421421
component.licenses.add(noassertion)
422422
if component.evidence:
423423
component.evidence.licenses.add(noassertion)

features/report-sbom-license.feature

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ Feature: SBOM license transparency for unresolved licenses
3535
"name": "SomeProject",
3636
"licenses": [
3737
{
38-
"expression": "NOASSERTION"
38+
"license": {
39+
"name": "NOASSERTION"
40+
}
3941
}
4042
],
4143
"properties": [
@@ -55,7 +57,9 @@ Feature: SBOM license transparency for unresolved licenses
5557
"evidence": {
5658
"licenses": [
5759
{
58-
"expression": "NOASSERTION"
60+
"license": {
61+
"name": "NOASSERTION"
62+
}
5963
}
6064
]
6165
}
@@ -88,7 +92,9 @@ Feature: SBOM license transparency for unresolved licenses
8892
"name": "SomeProject",
8993
"licenses": [
9094
{
91-
"expression": "NOASSERTION"
95+
"license": {
96+
"name": "NOASSERTION"
97+
}
9298
}
9399
],
94100
"properties": [
@@ -108,7 +114,9 @@ Feature: SBOM license transparency for unresolved licenses
108114
"evidence": {
109115
"licenses": [
110116
{
111-
"expression": "NOASSERTION"
117+
"license": {
118+
"name": "NOASSERTION"
119+
}
112120
}
113121
]
114122
}

0 commit comments

Comments
 (0)