A simple script and pre-commit hook to automatically update the exclude regex patterns
in your .pre-commit-config.yaml. This tool helps maintain clean and consistent exclusions
across multiple repositories by merging default exclusions with custom rules.
- Reads default exclusions and appends custom exclusions from a separate file.
- Updates the
exclude:block in.pre-commit-config.yamlsafely. - Can be used as a standalone script or integrated as a pre-commit hook.
- Designed to be reused across hundreds of repositories.
Before using the script or hook, ensure your .pre-commit-config.yaml file contains the
exclude: block delimited by these two comment lines exactly as shown:
# Start exclude
exclude: |
# End excludeThis allows the script to correctly locate and replace the exclusion patterns.
Place your default exclusions in .pre-commit-default-exclusions and
your custom exclusions in .pre-commit-exclusions.
Run the update script:
./update_exclusions.shAdd the following to your .pre-commit-config.yaml:
- repo: https://github.com/Romathi/pre-commit-exclusions
rev: v0.2.2
hooks:
- id: update-exclusions