Releases: Lucas-C/pre-commit-hooks
Support for multiple license files
Added
+ Update multiple licence year ends in one run
+ Multiple license files
If more than one --license-filepath
argument is specified, the checks are
performed as follows:
-
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. -
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. -
Finally, if neither exact nor fuzzy matches are found, the content of
the first license file is inserted.
Preserve line endings when editing file in insert_license hook
insert_license: new --allow-past-years parameter allows stale years to be left unchanged
pre-commit
3.2.0 or superior.
If you get an error like Expected one of ... but got: 'pre-commit'
, check this issue: #83
Renamed chmod hook to pre_commit_chmod to avoid conflict with standard chmod command
Using pre-commit built-in text files detection feature
New hook: chmod + using rapidfuzz instead of fuzzywuzzy
Usage
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.0
hooks:
- id: chmod
args: ['644']
files: \.md$
insert-license: bugfixes for --use-current-year optional flag
v1.4.2 New release v1.4.2
insert-license: new --use-current-year optional flag
Handling years flexibly
You can add --use-current-year
to change how the hook treats years in the
headers:
- When inserting a header, the current year will always be inserted
regardless of the year listed in the license file. - When modifying a file that already has a header, the hook will ensure the
current year is listed in the header by using a range. For instance,
2015
or2015-2018
would get updated to2015-2023
in the year 2023. - When removing headers, the licenses will be removed regardless of the
years they contain -- as if they used the year currently present in the
license file.
remove-tabs alignment now considers the enclosing whitespaces + ensured support for Python 3.11
Thanks to @GadgetSteve for the improvement on remove-tabs
: #62
Supporting Python 3.10+
Supporting Python 3.10 by using python-Levenshtein package instead of python-Levenshtein-wheels