I want to use the default configuration of enabled/disabled checks from CLion (with some small changes) and I want to enforce it when building my application.
Enforcing clang-tidy works perfectly by using the cmake directive for clang-tidy, for example with all checks enabled:
set(CMAKE_CXX_CLANG_TIDY clang-tidy;
-checks=*,
-warnings-as-errors=*;
)
The default list of enabled and disabled checks in CLion can be found on the website but not in a machine readable way.
Is it possible to dump the config that CLion uses, like it is for clang-format, because the clang-tidy
executable provides the option -dump-config
? If so, how?
Copy the list of rules from Clion to a file named rules.txt
:
Then:
clang-tidy -checks="$(cat rules.txt | tr '\n' ',' | sed 's/,$//')" --dump-config > .clang-tidy
Here is a gist with the result as the day of writing this: https://gist.github.com/ArnaudValensi/0d36639fb84b80ee57d0c3c977deb70e