From aa7f2df15e91f5c94807247228cf82e18fe03887 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Thu, 15 Jan 2026 21:15:00 +0700 Subject: all: allow multiple pattern in match-file-comment This makes the configuration more concise where pattern can be split into multi lines. While at it, add more pattern to match-file-comment. --- testdata/Apply_fromReport_test.txt | 19 +++++++++++++++---- testdata/Apply_test.txt | 19 +++++++++++++++---- testdata/loadConfig/config_exists/spdxconv.cfg | 15 ++++++++++++--- testdata/scan/spdxconv.cfg | 24 +++++++++++------------- 4 files changed, 53 insertions(+), 24 deletions(-) (limited to 'testdata') diff --git a/testdata/Apply_fromReport_test.txt b/testdata/Apply_fromReport_test.txt index cecf3ee..8a9eaf8 100644 --- a/testdata/Apply_fromReport_test.txt +++ b/testdata/Apply_fromReport_test.txt @@ -13,11 +13,17 @@ copyright_year = 2026 file_copyright_text = M. Shulhan [match-file-comment] -pattern = "^.*\\.(adoc|asciidoc|c|cc|cpp|cs|dart|go|h|hh|hpp|java|js|jsx|jsonc|kt|kts|php|rs|sass|scss|swift|ts|tsx)$" +pattern = "^.*\\.(adoc|asciidoc|c|cc|cpp|cs|dart|go|h|hh|hpp|java|js|jsx)$" +pattern = "^.*\\.(jsonc|kt|kts|php|rs|sass|scss|swift|ts|tsx)$" +pattern = "^(.*/)?(go.mod|go.work)$" prefix = "//" [match-file-comment] -pattern = "^.*\\.(aff|bash|csh|dockerfile|env|gitignore|hcl|ipynb|make|pl|pm|py|ps1|rb|sh|tf|yaml|yml|zsh)$" +pattern = "^.*\\.(aff|bash|csh|dockerfile|env|gitignore|hcl|ipynb|make)$" +pattern = "^.*\\.(pl|pm|py|ps1|rb|sh|tf|yaml|yml|zsh)$" +pattern = "^(.*/)?[Mm]akefile$" +# systemd.unit(5). +pattern = "^.*\\.(automount|device|mount|path|scope|service|slice|socket|swap|target|timer)$" prefix = "#" [match-file-comment] @@ -26,7 +32,7 @@ prefix = "/*" suffix = "*/" [match-file-comment] -pattern = "^.*\\.(fxml|htm|html|html5|kml|markdown|md|xml)$" +pattern = "^.*\\.(fxml|gohtml|htm|html|html5|kml|markdown|md|xml)$" prefix = "" @@ -45,7 +51,12 @@ prefix = "%" # File name that match with this pattern will have the ".license" file # created. [match-file-comment] -pattern = "^.*\\.(apk|app|bz2|csv|doc|docx|exe|gif|gz|jpeg|jpg|json|pdf|png|ppt|pptx|svg|svgz|tar|tgz|xls|xlsx|zip)$" +pattern = "^.*\\.(apk|app|bz2|exe|gz|tar|tgz|zip)$" +pattern = "^.*\\.(csv|doc|docx|json|pdf|ppt|pptx|xls|xlsx)$" +pattern = "^.*\\.(bmp|gif|ico|jpeg|jpg|png|svg|svgz)$" +pattern = "^.*\\.(3gp|avi|flv|mkv|mp3|mp4|mpeg|mpg|mpg4)$" +pattern = "^.*\\.(acc|ogg|mp3)$" +pattern = "^(.*/)?(go.sum|go.work.sum)$" [match-license] pattern = "^(//+|#+|/\\*+|" @@ -45,7 +51,12 @@ prefix = "%" # File name that match with this pattern will have the ".license" file # created. [match-file-comment] -pattern = "^.*\\.(apk|app|bz2|csv|doc|docx|exe|gif|gz|jpeg|jpg|json|pdf|png|ppt|pptx|svg|svgz|tar|tgz|xls|xlsx|zip)$" +pattern = "^.*\\.(apk|app|bz2|exe|gz|tar|tgz|zip)$" +pattern = "^.*\\.(csv|doc|docx|json|pdf|ppt|pptx|xls|xlsx)$" +pattern = "^.*\\.(bmp|gif|ico|jpeg|jpg|png|svg|svgz)$" +pattern = "^.*\\.(3gp|avi|flv|mkv|mp3|mp4|mpeg|mpg|mpg4)$" +pattern = "^.*\\.(acc|ogg|mp3)$" +pattern = "^(.*/)?(go.sum|go.work.sum)$" [match-license] pattern = "^(//+|#+|/\\*+|