Skip to content

Compilation Database Support #197

@shenxianpeng

Description

@shenxianpeng

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions