Metadata-Version: 2.4
Name: pre_commit_excludes
Version: 0.4.0
Summary: Tools to maintain pre-commit exclude lists
Keywords: pre-commit,prek
Author: Markus Hofbauer, Chris Bachhuber
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Version Control :: Git
Requires-Dist: ruamel-yaml>=0.19.1
Requires-Python: >=3.10
Project-URL: Homepage, https://github.com/hofbi/dev-tools
Project-URL: Repository, https://github.com/hofbi/dev-tools
Project-URL: Issues, https://github.com/hofbi/dev-tools/issues
Description-Content-Type: text/markdown

# Pre-Commit-Excludes

<!-- rumdl-disable MD013 -->
[![PyPI](https://img.shields.io/pypi/v/pre-commit-excludes)](https://pypi.org/project/pre-commit-excludes/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pre-commit-excludes)](https://pypi.org/project/pre-commit-excludes/)
[![PyPI - License](https://img.shields.io/pypi/l/pre-commit-excludes)](https://pypi.org/project/pre-commit-excludes/)
<!-- rumdl-enable MD013 -->

`remove-unnecessary-excludes` should help you to find lines in your exclude list that are no longer required.
Running this tool will try to remove excludes from your config by removing a line, running the hook, and restore the old config if it is still required.

Right now this is in early development, so we don't automatically update the `.pre-commit-config.yaml` with all unnecessary excludes removed.
Instead, we only print which excludes can be removed for which hook.
More automation will come in future releases.

> [!NOTE]
> This hook deliberately only supports simple `|`-separated lists of file paths in `exclude` fields — complex regular expressions are not supported.
> Keeping exclusions as plain `|`-separated paths also makes it easier for humans to maintain an overview of what is excluded.

## Usage

```shell
# Cleanup the entire config for all hooks
uvx --from pre-commit-excludes remove-unnecessary-excludes .pre-commit-config.yaml --pre-commit-binary prek --git-binary git --all

# Cleanup only specific hooks such as typos and ruff-check
uvx --from pre-commit-excludes remove-unnecessary-excludes .pre-commit-config.yaml --pre-commit-binary prek --git-binary git --hook typos --hook ruff-check

# Skip excludes that you want to keep
uvx --from pre-commit-excludes remove-unnecessary-excludes .pre-commit-config.yaml --pre-commit-binary prek --git-binary git --all --skip-exclude "check-json:tests/invalid.json"
```
