From 2a8ab762eabbe53f358eecd337872957d1afa01c Mon Sep 17 00:00:00 2001 From: Shulhan Date: Mon, 12 Jan 2026 16:10:30 +0700 Subject: config_match_license: remove unused field DeleteMatch The line that match with pattern will be replaced with new SPDX license identifier, so no need to guard it with this flag. --- README.md | 3 --- config.go | 1 - config_match_license.go | 4 ---- spdxconv_test.go | 3 +-- testdata/Apply_test.txt | 2 -- testdata/loadConfig/config_exists/spdxconv.cfg | 1 - testdata/scan/spdxconv.cfg | 1 - 7 files changed, 1 insertion(+), 14 deletions(-) diff --git a/README.md b/README.md index 68f2302..6a028c9 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,6 @@ max_line_match = 10 [match-license] pattern = "^(//+|#+)\\s+(.*)governed by a BSD-style(.*)$" license_identifier = BSD-3-Clause -delete_match = true delete_line_pattern = "^(//+|#+)\\s+license that(.*)$" [match-copyright] @@ -111,8 +110,6 @@ regular expression. If there is a line that match with it, the value in "match-license::license_identifier" will replace the "default::license_identifier" value. -If the "delete_match" is true, it will delete the matched line from the -file. If there is "delete_line_pattern" defined, it will search for line that match with that pattern and delete it. The "delete_line_pattern" can be defined zero or multiple times. diff --git a/config.go b/config.go index 1de5d7f..0fd2705 100644 --- a/config.go +++ b/config.go @@ -18,7 +18,6 @@ max_line_match = 10 [match-license] pattern = "^(//+|#+)\\s+(.*)governed by a BSD-style(.*)$" license_identifier = BSD-3-Clause -delete_match = true delete_line_pattern = "^(//+|#+)\\s+license that(.*)$" [match-copyright] diff --git a/config_match_license.go b/config_match_license.go index 3caddc1..818e806 100644 --- a/config_match_license.go +++ b/config_match_license.go @@ -24,10 +24,6 @@ type configMatchLicense struct { // A line that match with this pattern will be deleted. // An empty line stop the search. DeleteLinePattern []string `ini:"match-license::delete_line_pattern"` - - // DeleteMatch if set to true, the line that match with Pattern will - // be deleted. - DeleteMatch bool `ini:"match-license::delete_match"` } func (cml *configMatchLicense) init() (err error) { diff --git a/spdxconv_test.go b/spdxconv_test.go index 68dca0f..8fbeb7e 100644 --- a/spdxconv_test.go +++ b/spdxconv_test.go @@ -163,8 +163,7 @@ func TestSPDXConv_loadConfig(t *testing.T) { DeleteLinePattern: []string{ `^(//+|#+)\s+license that(.*)$`, }, - DeleteMatch: true, - rePattern: regexp.MustCompile(`^(//+|#+)\s+(.*)governed by a BSD-style(.*)$`), + rePattern: regexp.MustCompile(`^(//+|#+)\s+(.*)governed by a BSD-style(.*)$`), reDeleteLine: []*regexp.Regexp{ regexp.MustCompile(`^(//+|#+)\s+license that(.*)$`), }, diff --git a/testdata/Apply_test.txt b/testdata/Apply_test.txt index 3ee49f4..712c2bc 100644 --- a/testdata/Apply_test.txt +++ b/testdata/Apply_test.txt @@ -14,8 +14,6 @@ file_copyright_text = M. Shulhan [match-license] pattern = "^(//+|#+)\\s+(.*)governed by a BSD-style(.*)$" license_identifier = BSD-3-Clause -delete_match = true -delete_line_pattern = "^(//+|#+)\\s*$" delete_line_pattern = "^(//+|#+)\\s+license that(.*)$" [match-copyright] diff --git a/testdata/loadConfig/config_exists/spdxconv.cfg b/testdata/loadConfig/config_exists/spdxconv.cfg index 1defeef..ec401a3 100644 --- a/testdata/loadConfig/config_exists/spdxconv.cfg +++ b/testdata/loadConfig/config_exists/spdxconv.cfg @@ -9,7 +9,6 @@ max_line_match = 10 [match-license] pattern = "^(//+|#+)\\s+(.*)governed by a BSD-style(.*)$" license_identifier = BSD-3-Clause -delete_match = true delete_line_pattern = "^(//+|#+)\\s+license that(.*)$" [match-copyright] diff --git a/testdata/scan/spdxconv.cfg b/testdata/scan/spdxconv.cfg index 1defeef..ec401a3 100644 --- a/testdata/scan/spdxconv.cfg +++ b/testdata/scan/spdxconv.cfg @@ -9,7 +9,6 @@ max_line_match = 10 [match-license] pattern = "^(//+|#+)\\s+(.*)governed by a BSD-style(.*)$" license_identifier = BSD-3-Clause -delete_match = true delete_line_pattern = "^(//+|#+)\\s+license that(.*)$" [match-copyright] -- cgit v1.3