diff options
| -rw-r--r-- | report.go | 10 | ||||
| -rw-r--r-- | spdxconv_test.go | 9 |
2 files changed, 18 insertions, 1 deletions
@@ -131,6 +131,10 @@ func (rep *report) scan(conv *SPDXConv, listFile []string) (err error) { if f.licenseID == valExist && f.copyrightText == valExist { continue } + if f.copyrightYear == `` { + rep.listUnknown = append(rep.listUnknown, f) + continue + } rep.listRegular = append(rep.listRegular, f) } return nil @@ -151,7 +155,9 @@ func (rep *report) write() (err error) { var csvw = csv.NewWriter(&buf) var record = make([]string, v1FieldsPerRecord) + buf.WriteString("//\n") buf.WriteString(reportMetaPrefix + reportGroupRegular + "\n") + buf.WriteString("//\n") for _, file := range rep.listRegular { record[0] = file.path record[1] = file.licenseID @@ -168,7 +174,9 @@ func (rep *report) write() (err error) { } csvw.Flush() + buf.WriteString("//\n") buf.WriteString(reportMetaPrefix + reportGroupBinary + "\n") + buf.WriteString("//\n") for _, file := range rep.listBinary { record[0] = file.path record[1] = file.licenseID @@ -185,7 +193,9 @@ func (rep *report) write() (err error) { } csvw.Flush() + buf.WriteString("//\n") buf.WriteString(reportMetaPrefix + reportGroupUnknown + "\n") + buf.WriteString("//\n") for _, file := range rep.listUnknown { record[0] = file.path record[1] = file.licenseID diff --git a/spdxconv_test.go b/spdxconv_test.go index 842102c..aa37cba 100644 --- a/spdxconv_test.go +++ b/spdxconv_test.go @@ -131,14 +131,21 @@ func TestScan(t *testing.T) { //spdxconv:version:v1 //spdxconv:header:path,license_id,idx_license_id,year,copyright_id,idx_copyright_id +// //spdxconv:regular +// no_copyright_year.md,match,2,2026,default,0,<!-- ," -->" test.go,match,1,2022,match,0,// , test.html,match,4,2022,match,1,<!-- ," -->" test.sh,default,0,2026,default,0,# , test.sql,match,1,2022,match,0,-- , +// //spdxconv:binary -//spdxconv:unknown` +// +// +//spdxconv:unknown +// +` test.Assert(t, `Scan: `+scanDir, exp, string(got)) } |
