diff options
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 42 |
1 files changed, 36 insertions, 6 deletions
@@ -109,12 +109,16 @@ prefix = "%" pattern = "^.*\\.(apk|app|bz2|csv|doc|docx|exe|gif|gz|jpeg|jpg|json|pdf|png|ppt|pptx|svg|svgz|tar|tgz|xls|xlsx|zip)$" [match-license] -pattern = "^(//+|#+)\\s+(.*)governed by a BSD-style(.*)$" +pattern = "^(//+|#+|/\\*+|<!--+)?\\s*(.*)governed by a BSD-style(.*)$" license_identifier = BSD-3-Clause -delete_line_pattern = "^(//+|#+)\\s+license that(.*)$" +delete_line_before = "^(//+|#+|/\\*+|<!--+)$" +delete_line_after = "^(//+|#+|/\\*+|<!--+)?\\s*license that can(.*)$" +delete_line_after = "^(//+|#+|\\*+/|--+>)$" [match-copyright] -pattern = "^(//+|#+)\\s+Copyright\\s+(?<year>\\d{4}),?\\s+(?<author>.*)\\s+<*(?<contact>.*)>.*$" +pattern = "^(//+|#+|/\\*+|<!--+)?\\s*Copyright\\s+(?<year>\\d{4}),?\\s+(?<author>.*)\\s+<(?<contact>.*)>.*$" +delete_line_before = "^(//+|#+|/\\*+|<!--+)$" +delete_line_after = "^(//+|#+|\\*+/|--+>)$" ``` The configuration use the `ini` file format. @@ -194,9 +198,35 @@ 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 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. + +If there is "delete_line_before" or "delete_line_after" defined, it will +search for the pattern before and after the matched line and delete it. +The "delete_line_before" and "delete_line_after" can be defined zero or +multiple times. + +### match-copyright section + +The match-copyright section define the pattern to match with old copyright +text. +The regex must contains named group to capture copyright year, author, and +contact. +For example, given the following old copyright text, + +``` +Copyright 2022, John Doe <john.doe@email>. All rights reserved. +``` + +we can capture the year, author, and contact using the following regex, + +``` +^(//+|#+|/\\*+|<!--+)?\\s*Copyright\\s+(?<year>\\d{4}),?\\s+(?<author>.*)\\s+<(?<contact>.*)>.*$" +``` + +The `match-copyright` section can also contains zero or more +`delete_line_before` and `delete_line_after` pattern. +The `delete_line_before` delete lines before matched line pattern, and +`delete_line_after` contains regex to delete lines after matched line +pattern. ## scan command |
