Skip to content

Commit cd91e29

Browse files
committed
OutputHTML: Prioritize license_references from scan data
The `--license-references` cli argument enables collection and storge of license reference data in output files. So as long as it was present during the scan and any subsequent conversion the `license_references` should not be empty. In such cases, the license reference table shall be filled with the already stored data. Only if the `license_references` list is empty, should the licenses be collected from the `license_db` as a fall back. Signed-off-by: Jens Keim <[email protected]>
1 parent 925e535 commit cd91e29

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/formattedcode/output_html.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def generate_output(results, license_references, version, template):
227227
'value': license_expression,
228228
})
229229

230-
if license_expression not in licenses:
230+
if not license_references and license_expression not in licenses:
231231
license_object = get_licenses_db().get(license_expression)
232232
if license_object != None:
233233
licenses[license_expression] = license_object
@@ -248,8 +248,9 @@ def generate_output(results, license_references, version, template):
248248
if PACKAGES in scanned_file:
249249
converted_packages[path] = scanned_file[PACKAGES]
250250

251-
licenses = dict(sorted(licenses.items()))
252-
license_references = list(licenses.values())
251+
if not license_references:
252+
licenses = dict(sorted(licenses.items()))
253+
license_references = list(licenses.values())
253254

254255
files = {
255256
'license_copyright': converted,

0 commit comments

Comments
 (0)