Report missing licenses or copyright text.

Required because spdx-rs 0.5.3 added support for SPDX  2.3 documents and made these fields optional.
This commit is contained in:
Jonathan Pallant (Ferrous Systems) 2023-11-21 12:59:03 +00:00
parent ce0051a42f
commit d45eac3d7c
No known key found for this signature in database

View File

@ -17,9 +17,11 @@ pub(crate) fn collect(
let mut result = Vec::new();
for file in document.file_information {
let concluded_license = file.concluded_license.expect("File should have licence info");
let copyright_text = file.copyright_text.expect("File should have copyright text");
let license = interner.intern(License {
spdx: file.concluded_license.to_string(),
copyright: file.copyright_text.split('\n').map(|s| s.into()).collect(),
spdx: concluded_license.to_string(),
copyright: copyright_text.split('\n').map(|s| s.into()).collect(),
});
result.push((file.file_name.into(), license));