If you use pre-commit, specify files
to include (or exclude
to exclude) specific directories, e.g. run hooks only in my_dir
:
files: ^my_dir/
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
hooks:
...
or run everywhere but inside my_dir
:
exclude: ^my_dir/
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
hooks:
...
If you have a long list of exclusions, use verbose regex:
exclude: >
(?x)^(
path/to/file1.py|
path/to/file2.py|
path/to/file3.py
)$
you can also apply these to specific hooks only, just do:
- id: my-hook
exclude: ^my_dir/