Problem
clang-tidy requires a compilation database (compile_commands.json) to
accurately analyze files in real-world C++ projects that use CMake, Meson,
or other build systems. Without it, clang-tidy falls back to guessing
compiler flags, which leads to false positives, missed warnings, and
incorrect --extra-arg workarounds.
Proposed Solution
Add an option to pass the compilation database path to the clang-tidy hook:
- id: clang-tidy
args: [--compile-commands=/path/to/build]
Optionally, auto-detect compile_commands.json from common locations
(e.g., ./build, ./out) if not explicitly specified.
Problem
clang-tidy requires a compilation database (
compile_commands.json) toaccurately analyze files in real-world C++ projects that use CMake, Meson,
or other build systems. Without it, clang-tidy falls back to guessing
compiler flags, which leads to false positives, missed warnings, and
incorrect
--extra-argworkarounds.Proposed Solution
Add an option to pass the compilation database path to the clang-tidy hook:
Optionally, auto-detect compile_commands.json from common locations
(e.g., ./build, ./out) if not explicitly specified.