Skip to content

Commit 338d8f3

Browse files
fix: linting
1 parent 4904993 commit 338d8f3

File tree

1 file changed

+32
-7
lines changed

1 file changed

+32
-7
lines changed

sbom2doc/generator.py

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
from packageurl import PackageURL
88

99
from sbom2doc.docbuilder.consolebuilder import ConsoleBuilder
10+
from sbom2doc.docbuilder.htmlbuilder import HTMLBuilder
1011
from sbom2doc.docbuilder.jsonbuilder import JSONBuilder
1112
from sbom2doc.docbuilder.markdownbuilder import MarkdownBuilder
1213
from sbom2doc.docbuilder.pdfbuilder import PDFBuilder
1314
from sbom2doc.docbuilder.spreadsheetbuilder import SpreadsheetBuilder
14-
from sbom2doc.docbuilder.htmlbuilder import HTMLBuilder
1515

1616

1717
def generate_document(format, sbom_parser, filename, outfile, include_license):
@@ -92,7 +92,19 @@ def generate_document(format, sbom_parser, filename, outfile, include_license):
9292
if len(packages) > 0:
9393
sbom_document.heading(1, "Package Summary")
9494
sbom_document.createtable(
95-
["Name", "Version", "PURL", "CPE", "Type", "Supplier", "License", "Ecosystem", "Download", "Copyright"], [12, 8, 8, 8, 12]
95+
[
96+
"Name",
97+
"Version",
98+
"PURL",
99+
"CPE",
100+
"Type",
101+
"Supplier",
102+
"License",
103+
"Ecosystem",
104+
"Download",
105+
"Copyright",
106+
],
107+
[12, 8, 8, 8, 12],
96108
)
97109
for package in packages:
98110
# Minimum elements are ID, Name, Version, Supplier
@@ -127,7 +139,20 @@ def generate_document(format, sbom_parser, filename, outfile, include_license):
127139
cpe = reference[2]
128140
download = package.get("downloadlocation", "NOT KNOWN")
129141
copyright = package.get("copyrighttext", "-")
130-
sbom_document.addrow([name, version, purl, cpe, type, supplier, license, ecosystem, download, copyright])
142+
sbom_document.addrow(
143+
[
144+
name,
145+
version,
146+
purl,
147+
cpe,
148+
type,
149+
supplier,
150+
license,
151+
ecosystem,
152+
download,
153+
copyright,
154+
]
155+
)
131156
if (
132157
id is None
133158
or name is None
@@ -207,11 +232,11 @@ def generate_document(format, sbom_parser, filename, outfile, include_license):
207232

208233
if len(vulnerabilities) > 0:
209234
sbom_document.heading(1, "Vulnerabilities Summary")
210-
sbom_document.createtable(["Id", "Source", "Status" ])
235+
sbom_document.createtable(["Id", "Source", "Status"])
211236
for vulnerability in vulnerabilities:
212237
id = vulnerability["id"]
213-
status = vulnerability.get("status","-")
214-
source = vulnerability.get("source","-")
238+
status = vulnerability.get("status", "-")
239+
source = vulnerability.get("source", "-")
215240
sbom_document.addrow([id, source, status])
216241
sbom_document.showtable(widths=[3, 2, 4, 5])
217242

@@ -222,7 +247,7 @@ def generate_document(format, sbom_parser, filename, outfile, include_license):
222247
# Ignore undefined licenses or expressions
223248
if key == "NOASSERTION" or license_info.license_expression(key):
224249
continue
225-
license_url = f"https://spdx.org/licenses/{key}.json"
250+
# license_url = f"https://spdx.org/licenses/{key}.json"
226251
try:
227252
license_text = license_info.get_license_text(key)
228253
if len(license_text) > 0:

0 commit comments

Comments
 (0)