clang-tidy

An LLVM-based C/C++ linter to find style violations, bugs and security flaws through static analysis. More information: <https://clang.llvm.org/extra/clang-tidy/>.

Install

All systems
curl cmd.cat/clang-tidy.sh
Debian Debian
apt-get install clang-tidy
Ubuntu
apt-get install clang-tidy
Arch Arch Linux
pacman -S clang-tidy
image/svg+xml Kali Linux
apt-get install clang-tidy
Fedora
dnf install clang-tools-extra
Windows (WSL2)
sudo apt-get update sudo apt-get install clang-tidy
Raspbian
apt-get install clang-tidy

An LLVM-based C/C++ linter to find style violations, bugs and security flaws through static analysis. More information: <https://clang.llvm.org/extra/clang-tidy/>.

  • Run default checks on a source file:
    clang-tidy path/to/file.cpp
  • Don't run any checks other than the `cppcoreguidelines` checks on a file:
    clang-tidy path/to/file.cpp -checks=-*,cppcoreguidelines-*
  • List all available checks:
    clang-tidy -checks=* -list-checks
  • Specify defines and includes as compilation options (after `--`):
    clang-tidy path/to/file.cpp -- -Imy_project/include -Ddefinitions

© tl;dr; authors and contributors