pre-commit-hooks

git pre-commit hooks

MIT License

Stars
111
pre-commit-hooks - Support for multiple license files Latest Release

Published by Lucas-C 9 months ago

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:

  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.

pre-commit-hooks - Preserve line endings when editing file in insert_license hook

Published by Lucas-C about 1 year ago

Changed

  • preserve line endings when editing file in insert_license hook -cf. #84
  • the chmod hook does nothing under Windows

⚠️ ⚠️ This hook, since v1.5.2, requires pre-commit 3.2.0 or superior.
If you get an error like Expected one of ... but got: 'pre-commit', check this issue: #83

pre-commit-hooks - insert_license: new --allow-past-years parameter allows stale years to be left unchanged

Published by Lucas-C about 1 year ago

⚠️ ⚠️ This hook, since v1.5.2, requires pre-commit 3.2.0 or superior.
If you get an error like Expected one of ... but got: 'pre-commit', check this issue: #83

pre-commit-hooks - Renamed chmod hook to pre_commit_chmod to avoid conflict with standard chmod command

Published by Lucas-C about 1 year ago

Also confined formatting-related hooks to meaningful stages - cf. PR #75

Now this hook requires pre-commit 3.2.0 or superior.
If you get an error like Expected one of ... but got: 'pre-commit', check this issue: #83

pre-commit-hooks - New hook: chmod + using rapidfuzz instead of fuzzywuzzy

Published by Lucas-C over 1 year ago

Usage

- repo: https://github.com/Lucas-C/pre-commit-hooks
  rev: v1.5.0
  hooks:
    - id: chmod
      args: ['644']
      files: \.md$
pre-commit-hooks - insert-license: bugfixes for --use-current-year optional flag

Published by Lucas-C almost 2 years ago

pre-commit-hooks - insert-license: new --use-current-year optional flag

Published by Lucas-C almost 2 years ago

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 or 2015-2018 would get updated to 2015-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.

Thanks to @GadgetSteve for the improvement on remove-tabs: https://github.com/Lucas-C/pre-commit-hooks/pull/62

pre-commit-hooks - Supporting Python 3.10+

Published by Lucas-C about 2 years ago

Supporting Python 3.10 by using python-Levenshtein package instead of python-Levenshtein-wheels

pre-commit-hooks - New --insert-license-after-regex & --no-extra-eol options

Published by Lucas-C over 2 years ago

pre-commit-hooks - Dropping support for Python 2.7 & 3.6

Published by Lucas-C over 2 years ago

pre-commit-hooks - Last version to support Python 2.7 & 3.6

Published by Lucas-C over 2 years ago

pre-commit-hooks - insert-license: added option --no-space-in-comment-prefix

Published by Lucas-C over 2 years ago

Thanks @mdeweerd for his contributions in PRs #30 & #33!

pre-commit-hooks - insert-license: adding support for ISO-8859-1 encoding

Published by Lucas-C over 2 years ago

pre-commit-hooks - Fixed IndexError while removing license file in files containing just the license header

Published by Lucas-C over 2 years ago

Thanks to @M5oul for reporting it in #25

pre-commit-hooks - Ignoring .gitmodules

Published by Lucas-C over 2 years ago

Changed

  • .gitmodules are now ignored by the forbid-tabs / remove-tabs hooks - thanks @henryiii!
pre-commit-hooks - Windows compatibility

Published by Lucas-C over 3 years ago

cf. https://github.com/Lucas-C/pre-commit-hooks/pull/19

Now using the wheels version of Levenshtein for Window compatibility - thanks @AntoineD & @dmateusp!

pre-commit-hooks - insert-license: Added fuzzy matching, honoring shebang/encoding

Published by Lucas-C about 5 years ago

Thanks to @potiuk for contributing those features to this project !