Back to home page

EIC code displayed by LXR

 
 

    


Warning, /acts/docs/pages/contributing/clang_tidy.md is written in an unsupported language. File is not indexed.

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