You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
args: [--checks=.clang-tidy, --version=18] # Specifies version
67
68
```
68
69
69
-
### Troubleshooting
70
-
71
-
> [!IMPORTANT]
72
-
> If your `pre-commit` runs longer than expected, it is highly recommended to add `files` in `.pre-commit-config.yaml` to limit the scope of the hook. This helps improve performance by reducing the number of files being checked and avoids unnecessary processing. Here's an example configuration:
files: ^(src|include)/.*\.(cpp|cc|cxx|h|hpp)$ # Limits to specific dirs and file types
82
-
- id: clang-tidy
83
-
args: [--checks=.clang-tidy, --version=18]
84
-
files: ^(src|include)/.*\.(cpp|cc|cxx|h|hpp)$
85
-
```
86
-
87
-
Alternatively, if you want to run the hooks manually on only the changed files, you can use the following command:
88
-
89
-
```bash
90
-
pre-commit run --files $(git diff --name-only)
91
-
```
92
-
93
-
This approach ensures that only modified files are checked, further speeding up the linting process during development.
94
-
95
-
### Debugging `clang-format` hook
96
-
97
-
If you encounter issues with the clang-format hook (such as exit code 247 or other errors), you can enable verbose output to show the list of processed files by passing the `-v` or `--verbose` argument in the `args` section.
args: [--style=file, --version=18, --verbose] # Add -v or --verbose for detailed output
106
-
```
107
-
108
70
## Output
109
71
110
72
### clang-format Output
@@ -175,6 +137,46 @@ Use -header-filter=.* to display errors from all non-system headers. Use -system
175
137
176
138
```
177
139
140
+
## Troubleshooting
141
+
142
+
### Performance Optimization
143
+
144
+
> [!WARNING]
145
+
> If your `pre-commit` runs longer than expected, it is highly recommended to add `files` in `.pre-commit-config.yaml` to limit the scope of the hook. This helps improve performance by reducing the number of files being checked and avoids unnecessary processing. Here's an example configuration:
files: ^(src|include)/.*\.(cpp|cc|cxx|h|hpp)$ # Limits to specific dirs and file types
154
+
- id: clang-tidy
155
+
args: [--checks=.clang-tidy, --version=18]
156
+
files: ^(src|include)/.*\.(cpp|cc|cxx|h|hpp)$
157
+
```
158
+
159
+
Alternatively, if you want to run the hooks manually on only the changed files, you can use the following command:
160
+
161
+
```bash
162
+
pre-commit run --files $(git diff --name-only)
163
+
```
164
+
165
+
This approach ensures that only modified files are checked, further speeding up the linting process during development.
166
+
167
+
### Verbose Output
168
+
169
+
If you encounter issues with the `clang-format` hook (such as exit code 247 or other errors), you can enable verbose output to show the list of processed files by passing the `-v` or `--verbose` argument in the `args` section.
0 commit comments