dan sinclair | 93cf346 | 2022-05-16 12:58:24 +0000 | [diff] [blame] | 1 | # 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 | |
| 13 | There 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 | |
| 18 | The Chromium build folder contains the `tricium` files used to run `clang-tidy` |
| 19 | |
| 20 | Running clang-tidy over all the source can be done with: |
| 21 | |
| 22 | ``` |
| 23 | cd .. |
| 24 | out/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 |
| 33 | files. |
| 34 | |
| 35 | |
| 36 | ## References |
| 37 | * https://chromium.googlesource.com/chromium/src.git/+/HEAD/docs/clang_tidy.md |