|
|
# clang-tidy
|
|
|
|
|
|
Set `-DCMAKE_EXPORT_COMPILE_COMMANDS=ON` in cmake so it is producing the build database `compile_commands.json`.
|
|
|
|
|
|
Then running [clang-tidy](http://clang.llvm.org/extra/clang-tidy/) on specific source files in the source directory will show the suggestions for the selected checks. In the following example first exclude all checks, then add all readability checks:
|
|
|
|
|
|
```sh
|
|
|
clang-tidy -checks='-*,*readability*' \
|
|
|
-p=path/to/compile_commands.json/ \
|
|
|
-header-filter='ProcessLib/LIE/HydroMechanics/' \
|
|
|
ProcessLib/LIE/HydroMechanics/*.cpp
|
|
|
```
|
|
|
This gives a set of suggestions.
|
|
|
|
|
|
If you want the suggestion to be applied add the `-fix -format-style=file` to the above command line.
|
|
|
|
|
|
See `clang-tidy -list-checks` (and other documentation) for the available checks. |
|
|
\ No newline at end of file |