If you work on Python projects, you've probably used pre-commit — running black, ruff, mypy before every git commit, blocking anything that doesn't meet the standard. This workflow is well-established in the Python ecosystem.
For C/C++ projects, it's a different story.
The official mirrors-clang-format hook only handles formatting. If you want clang-tidy for static analysis, you're on your own. Features like compilation database auto-detection, version pinning, or auto-fix? Not even on the radar.
(139 stars on GitHub Marketplace). It's a GitHub Action that runs clang-format and clang-tidy in CI pipelines and surfaces results as file annotations, thread comments, and PR reviews.
cpp-linter-hooks and cpp-linter-action are two complementary tools under the same organization:
cpp-linter-action: runs in CI, designed for the PR review workflow
cpp-linter-hooks: runs locally beforegit commit, designed for daily development
Both share the same .clang-format and .clang-tidy configuration files. Code that passes locally won't break in CI — a classic "local + CI dual-gate" pattern.
Wrapping Up
cpp-linter-hooks is one of the main projects I maintain under the cpp-linter organization. Since 2022, it has grown to include version pinning, compilation database detection, auto-fix, and parallel execution — covering the core needs of C/C++ projects at the pre-commit stage.
If you develop in C/C++ or maintain a C/C++ open-source project, give it a try. Add it to your .pre-commit-config.yaml, and within minutes you'll have automatic formatting and static analysis running before every commit — no more waiting for CI to go red before fixing things.
- GitHub:
Issues and feedback are welcome on GitHub.
SOCIAL SHARE CARD GENERATOR