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
cpp-linter-hooks is a [pre-commit](https://pre-commit.com/) hook that uses `clang-format` and `clang-tidy` to format C/C++ code.
9
+
A powerful [pre-commit](https://pre-commit.com/) hook for auto-formatting and linting C/C++ code with `clang-format` and `clang-tidy`.
11
10
12
-
> [!NOTE]
13
-
> This hook automatically downloads specific versions of `clang-format` or `clang-tidy`[static-binaries](https://github.com/cpp-linter/clang-tools-static-binaries) and installs them on your system.
To use custom configurations like `.clang-format` and `.clang-tidy`:
35
43
@@ -44,6 +52,8 @@ repos:
44
52
args: [--checks=.clang-tidy] # Loads checks from .clang-tidy file
45
53
```
46
54
55
+
### Custom Clang Tool Version
56
+
47
57
To use specific versions of [clang-tools](https://github.com/cpp-linter/clang-tools-pip?tab=readme-ov-file#supported-versions):
48
58
49
59
```yaml
@@ -57,33 +67,9 @@ repos:
57
67
args: [--checks=.clang-tidy, --version=18] # Specifies version
58
68
```
59
69
60
-
> [!IMPORTANT]
61
-
> 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:
@@ -151,10 +137,51 @@ Use -header-filter=.* to display errors from all non-system headers. Use -system
151
137
152
138
```
153
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:
0 commit comments