Details on clang-tidy authored by Sébastien Villemot's avatar Sébastien Villemot
...@@ -215,3 +215,27 @@ You should add the following notice at the very beginning of your all your sourc ...@@ -215,3 +215,27 @@ You should add the following notice at the very beginning of your all your sourc
*/ */
``` ```
## Static analysis
Various static checks can be performed on the code using `clang-tidy`. A `.clang-tidy` file is provided in both `dynare.git` and `preprocessor.git`, that enables a number of checks.
### Running static checks with meson
When `clang-tidy` is installed, Meson is able to autodetect it and then
creates a rule for checking the whole git repository (NB: this does not
recurse into submodules). That rule can be invoked with:
```
ninja -C <builddir> clang-tidy
```
It is also possible to automatically apply some fixes
(requires Meson 1.3 or higher):
```
ninja -C <builddir> clang-tidy-fix
```
### Running static checks within the GitLab pipeline
Pipelines for both `dynare.git` and `preprocessor.git` have a `test_clang_tidy` job that can be run manually from GitLab.