Search⌘ K
AI Features

Introduction to Checkers

Explore various checkers supported by CMake for improving C++ code quality through static and dynamic analysis. Understand how tools like Clang-Tidy, Cpplint, Cppcheck, include-what-you-use, and link-what-you-use help identify bugs, enforce style guidelines, remove unnecessary includes, and optimize linking. Learn to select appropriate checkers based on project needs, enhancing build efficiency and code safety.

Depending on our use case, the size of the repository, and team preferences, we should probably choose a few checkers that are a good match. Adding too many will become a nuisance. Here's a short introduction to checkers supported by CMake out-of-the-box.

Clang-Tidy

Here is a description of Clang-Tidy from the official website:

clang-tidy is a clang-based C++ “linter” tool. Its purpose is to provide an extensible framework
for diagnosing and fixing typical programming errors, like style violations, interface misuse, or
bugs that can be deduced via static analysis. clang-tidy is modular and provides a convenient
interface for writing new checks.

The versatility of this tool is really impressive, as it offers over 400 checks. It works ...