diff --git a/README.md b/README.md index 0db924a..cc3d988 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ this issue: [#83](https://github.com/Lucas-C/pre-commit-hooks/issues/83) - [Handling years flexibly](#handling-years-flexibly) - [No extra EOL](#no-extra-eol) - [Fuzzy license matching](#fuzzy-license-matching) + - [Multiple license files](#multiple-license-files) - [Handy shell functions](#handy-shell-functions) - [Useful local hooks](#useful-local-hooks) - [Forbid / remove some unicode characters](#forbid--remove-some-unicode-characters) @@ -168,6 +169,23 @@ License insertion can be skipped altogether if the file contains the `SKIP LICENSE INSERTION` in the first X top lines. This can also be overridden by `--skip-license-insertion-comment=` flag. +#### Multiple license files + +If more than one `--license-filepath` argument is specified, the checks are +performed as follows: + +1. First, an exact match is pursued, checking the 1st license file, then + the 2nd, and so on. If a match is found, the normal behavior is + followed, as if the matched license file was the only license file + specified. + +2. If no exact match is found, then the software resorts to fuzzy matching. + Again, as soon as a match is found, the normal behavior is followed, as + if the fuzzy-matched license file was the only license file specified. + +3. Finally, if neither exact nor fuzzy matches are found, the content of + the first license file is inserted. + ## Handy shell functions ```shell diff --git a/pre_commit_hooks/insert_license.py b/pre_commit_hooks/insert_license.py index f265962..f9acc84 100644 --- a/pre_commit_hooks/insert_license.py +++ b/pre_commit_hooks/insert_license.py @@ -194,7 +194,7 @@ def get_license_info_list(args) -> list[LicenseInfo]: return license_info_list -def process_files( +def process_files( # pylint: disable=too-many-branches args, changed_files: list[str], todo_files: list[str],