blob: e2f9738c7fde67f03d2037fbc91db04c2aa126b2 [file] [log] [blame] [view]
dan sinclair93cf3462022-05-16 12:58:24 +00001# Running clang-tidy
2
3* Add `"checkout_clang_tidy": True` to `.gclient` file in the `custom_vars`.
4 ```
5 {
6 "custom_vars": {
7 "checkout_clang_tidy": True,
8 }
9 }
10 ```
11* `gclient sync`
12
13There should now be `third_party/llvm-build/Release+Asserts/bin/clang-tidy`
14
15* `cd out`
16* `git clone https://chromium.googlesource.com/chromium/tools/build`
17
18The Chromium build folder contains the `tricium` files used to run `clang-tidy`
19
20Running clang-tidy over all the source can be done with:
21
22```
23cd ..
24out/build/recipes/recipe_modules/tricium_clang_tidy/resources/tricium_clang_tidy_script.py \
25--base_path $PWD \
26--out_dir out/Debug \
27--findings_file all_findings.json \
28--clang_tidy_binary $PWD/third_party/llvm-build/Release+Asserts/bin/clang-tidy \
29--all
30```
31
32`--all` can be replaced by specific files if desired to run on individual source
33files.
34
35
36## References
37* https://chromium.googlesource.com/chromium/src.git/+/HEAD/docs/clang_tidy.md