From 73252709ac8f73d1be5f9752d5f1dda79a9c85a4 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Thu, 15 Jan 2026 19:21:33 +0700 Subject: report: do not return an error if report file does not exist When scan running, it will try to load the previous report file to minimize re-scanning of file that has been applied or detected (regular or binary). If the report file does not exist, do not return the error, keep going. --- testdata/Scan_noConfigAndReport/.gitignore | 5 +++ testdata/Scan_test.txt | 64 ++++++++++++++++++++++++++++++ testdata/scan/.gitignore | 5 ++- 3 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 testdata/Scan_noConfigAndReport/.gitignore create mode 100644 testdata/Scan_test.txt (limited to 'testdata') diff --git a/testdata/Scan_noConfigAndReport/.gitignore b/testdata/Scan_noConfigAndReport/.gitignore new file mode 100644 index 0000000..405fc5e --- /dev/null +++ b/testdata/Scan_noConfigAndReport/.gitignore @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-3.0-only +# SPDX-FileCopyrightText: 2026 M. Shulhan + +* +!/.gitignore diff --git a/testdata/Scan_test.txt b/testdata/Scan_test.txt new file mode 100644 index 0000000..dca80da --- /dev/null +++ b/testdata/Scan_test.txt @@ -0,0 +1,64 @@ +// SPDX-License-Identifier: CC0-1.0 +// SPDX-FileCopyrightText: 2026 M. Shulhan + +Test spdxconv.Scan function. + +>>> scan/spdxconv.report +// Reset the report. + +<<< scan/spdxconv.report +// SPDX-License-Identifier: CC0-1.0 +// SPDX-FileCopyrightText: 2026 M. Shulhan + +//spdxconv:version:v1 +//spdxconv:header:path,license_id,idx_license_id,year,copyright_id,idx_copyright_id +// +//spdxconv:regular +// +Makefile,default,0,2026,default,0,#, +go.mod,default,0,2026,default,0,//, +no_copyright_year.md,match,2,2026,default,0, +po/included.go,match,1,2026,match,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 +// +go.sum,default,0,2026,default,0,, +test.json,default,0,2026,default,0,, +// +//spdxconv:unknown +// +// +//spdxconv:done +// +.gitignore,exist,0,,exist,1,#, +a/b/.gitignore,exist,0,,exist,1,#, +po/test.po,,0,,,0,, +po/test.pot,,0,,,0,, +with_spdx.go,exist,0,,exist,1,//, + +>>> Scan_noConfigAndReport/spdxconv.report +// Reset the report. + +<<< Scan_noConfigAndReport/spdxconv.report +// SPDX-License-Identifier: CC0-1.0 +// SPDX-FileCopyrightText: 2026 M. Shulhan + +//spdxconv:version:v1 +//spdxconv:header:path,license_id,idx_license_id,year,copyright_id,idx_copyright_id +// +//spdxconv:regular +// +// +//spdxconv:binary +// +// +//spdxconv:unknown +// +.gitignore,,0,,,0,, +// +//spdxconv:done +// diff --git a/testdata/scan/.gitignore b/testdata/scan/.gitignore index c13f6d6..d7514af 100644 --- a/testdata/scan/.gitignore +++ b/testdata/scan/.gitignore @@ -1,7 +1,8 @@ # SPDX-License-Identifier: GPL-3.0-only # SPDX-FileCopyrightText: 2025 M. Shulhan -node_modules/ -*.html !test.html +*.html +node_modules/ +spdxconv.report vendor/ -- cgit v1.3