Skip to content

Commit f0a3e1c

Browse files
committed
docs: add example to use files in pre-commmit
1 parent 753f2bb commit f0a3e1c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,21 @@ repos:
5757
args: [--checks=.clang-tidy, --version=16] # Specifies version
5858
```
5959

60+
> [!IMPORTANT]
61+
> If you run `pre-commit` longer than expected, highly suggest to add `files` in `hooks` to limit the scope of the hook. For example below:
62+
63+
```yaml
64+
- repo: https://github.com/cpp-linter/cpp-linter-hooks
65+
rev: v0.6.1
66+
hooks:
67+
- id: clang-format
68+
args: [--style=file, --version=16]
69+
files: ^(src|include)/.*\.(cpp|cc|cxx|h|hpp)$ # limit the scope
70+
- id: clang-tidy
71+
args: [--checks=.clang-tidy, --version=16]
72+
files: ^(src|include)/.*\.(cpp|cc|cxx|h|hpp)$
73+
```
74+
6075
## Output
6176

6277
### clang-format Example

0 commit comments

Comments
 (0)