Clang-Tidy is a popular clang-based tool for static code analysis. CLion supports Clang-Tidy in the same way as its own code analysis tool.
How to configure Clang-Tidy profile
Clang-Tidy checks are enabled by default in CLion and you can see them as the warnings or messages of other severity levels in the editor. Here you can find the details on the Clang-Tidy default configuration in CLion. Note, that not all the checks are enabled by default.
You can change the Clang-Tidy configuration in Inspections Settings dialog ( (or for macOS users), select C/C++ | General | Clang-Tidy.
To configure the list of checks to enable / disable in text form, use the Clang-Tidy command line format (see example below).
To set up the desired severity level and scope for all the checks select the values from the drop-down lists of the Inspections Settings dialog.
If you need to switch Clang-Tidy checks off completely, unselect the corresponding check-box (the right column) or select this check-box to enable Clang-Tidy checks support again.
Per check configurations
You can disable a particular Clang-Tidy check from the CLion context menu, as follows: This action will update the list of enabled/disable checks in : In this context menu you can also find an option to suppress Clang-Tidy check for a particular line via
Let's run the C++ Core Guidelines checks on the project. To do that, open the Settings dialog (see above) and pass the following line
-*,cppcoreguidelines-*: As the result, only C++ Core Guidelines checks are running on the project: The same, pass
-*,clang-analyzer-* line to run the Clang Static Analyzer checks or
-*,modernize-* for modernize checks.