diff options
| author | Shulhan <ms@kilabit.info> | 2026-01-12 16:10:30 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2026-01-12 21:19:48 +0700 |
| commit | 2a8ab762eabbe53f358eecd337872957d1afa01c (patch) | |
| tree | 2c4e2363e9a051c7b1534e28e3c8883da45099c3 | |
| parent | 1dbd1e4c64a65c2f601cae42e63e6c5150c3acca (diff) | |
| download | spdxconv-2a8ab762eabbe53f358eecd337872957d1afa01c.tar.xz | |
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.
| -rw-r--r-- | README.md | 3 | ||||
| -rw-r--r-- | config.go | 1 | ||||
| -rw-r--r-- | config_match_license.go | 4 | ||||
| -rw-r--r-- | spdxconv_test.go | 3 | ||||
| -rw-r--r-- | testdata/Apply_test.txt | 2 | ||||
| -rw-r--r-- | testdata/loadConfig/config_exists/spdxconv.cfg | 1 | ||||
| -rw-r--r-- | testdata/scan/spdxconv.cfg | 1 |
7 files changed, 1 insertions, 14 deletions
@@ -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. @@ -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 <ms@kilabit.info> [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] |
