Warning, /acts/docs/contribution/clang_tidy.md is written in an unsupported language. File is not indexed.
0001 # What is clang-tidy?
0002
0003 [`clang-tidy`](https://clang.llvm.org/extra/clang-tidy/) is a static analysis
0004 tool using the LLVM / clang tooling. It can detect a number of issues with C++
0005 code, like common readability problems, performance or memory safety issues.
0006
0007 The ACTS CI automatically runs `clang-tidy` on all compilation units to detect
0008 as many problems as possible, and requires developers to resolve them. It is
0009 configured with a file `.clang-tidy` located in the repository root. Many
0010 editors / IDEs support `clang-tidy` and will automatically pick up this
0011 configuration file.
0012
0013 By default, only a limited number of checks are configured in this file, but
0014 this list might change in the future. If you experience CI failures that are
0015 associated with `clang-tidy`, you can drill down into the CI job outputs to get
0016 a report on the issues it detected. The report should give you an error /
0017 warning code, e.g. `readability-braces-around-statements`. The LLVM
0018 documentation has details on all possible error codes, in this particular
0019 example you would find it [here][readability]. This page will tell you that
0020 `clang-tidy` wants you to replace
0021
0022 ```cpp
0023 if (condition)
0024 statement;
0025 ```
0026
0027 with
0028
0029 ```cpp
0030 if (condition) {
0031 statement;
0032 }
0033 ```
0034
0035 Some error codes are less obvious, or not this trivial to fix. When in doubt,
0036 @mention the ACTS maintainers on your pull request.
0037
0038 [readability]: https://clang.llvm.org/extra/clang-tidy/checks/readability/braces-around-statements.html