From 069380e6b34d36ca2ace9c0d7e2ec4efdc4a2736 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Sun, 11 Jan 2026 21:27:58 +0700 Subject: all: exclude file that contains both SPDX license and copyright text If the file already contains SPDX-License-Identifier and SPDX-FileCopyrightText, in any order, ignore it from being included during scan. --- testdata/Apply_test.txt | 22 +++++++++++++++++++--- testdata/scan/with_spdx.go | 4 ++++ 2 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 testdata/scan/with_spdx.go (limited to 'testdata') diff --git a/testdata/Apply_test.txt b/testdata/Apply_test.txt index ba51ede..3ee49f4 100644 --- a/testdata/Apply_test.txt +++ b/testdata/Apply_test.txt @@ -59,17 +59,33 @@ pattern = "^(//+|#+)\\s+Copyright\\s+(?\\d{4}),?\\s+(?.*)\\s+<*(?< 2 3 ->>> with_no_order.txt -// SPDX-FileCopyrightText: 2026 M. Shulhan +>>> with_spdx.txt +// SPDX-License-Identifier: BSD-3-Clause +// SPDX-FileCopyrightText: 2018 Shulhan + +1 +2 +3 + +<<< with_spdx.txt // SPDX-License-Identifier: BSD-3-Clause +// SPDX-FileCopyrightText: 2018 Shulhan 1 2 3 -<<< with_no_order.txt +>>> with_spdx_no_order.txt +// SPDX-FileCopyrightText: 2026 M. Shulhan // SPDX-License-Identifier: BSD-3-Clause + +1 +2 +3 + +<<< with_spdx_no_order.txt // SPDX-FileCopyrightText: 2026 M. Shulhan +// SPDX-License-Identifier: BSD-3-Clause 1 2 diff --git a/testdata/scan/with_spdx.go b/testdata/scan/with_spdx.go new file mode 100644 index 0000000..c30ff8f --- /dev/null +++ b/testdata/scan/with_spdx.go @@ -0,0 +1,4 @@ +// SPDX-License-Identifier: GPL-3.0-only +// SPDX-FileCopyrightText: 2026 M. Shulhan + +package spdxconv -- cgit v1.3-6-g1900