docs: add guide on running clang-tidy on pull requests with GitHub Actions - #62
Open
shenxianpeng wants to merge 2 commits into
Open
shenxianpeng wants to merge 2 commits into
shenxianpeng wants to merge 2 commits into
Conversation
✅ Deploy Preview for cpp-linter-github-io ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
People search for "clang-tidy github actions" and "clang-tidy pull request comments", and for those queries platisd/clang-tidy-pr-comments and ZedThree/clang-tidy-review rank ahead of cpp-linter-action. The site has no page that answers that question from start to finish; the two existing posts assume the reader already has a lint workflow. This is the first of a few how-to posts written around what people actually search for.
What's in this PR
One new post in the Guides category: Run clang-tidy on pull requests with GitHub Actions (
docs/blog/posts/2026-09-20-clang-tidy-pull-requests-github-actions.md), published at/blog/2026/09/20/clang-tidy-github-actions-pull-requests/(explicitslug, plus a metadescription).It follows the places where people get stuck:
.clang-tidy(bugprone-*,performance-*,clang-analyzer-*, explicitHeaderFilterRegex).compile_commands.jsonwith CMake, Meson, Make + Bear, orextra-argswhen there is no build system.files-changed-only/lines-changed-onlyand what each value reports.clang-tidy-checks-failedoutput, and rolling that out gradually.pull_request_target.Two details worth a look from someone who knows the action well:
tidy-checksvalue is appended to theChecksin.clang-tidy, and recommendstidy-checks: ''. That is taken from the input description inaction.yml.HeaderFilterRegexmatches. That is from the LLVM 22 release notes, and is the reason the starter config setsHeaderFilterRegexexplicitly.I left out the note about thread comments being disabled on private repositories, because I could not find the matching behaviour in the cpp-linter source.
Checks
action.ymlat v2.22.0,docs/permissions.mdanddocs/pr-review-caveats.md; the hook arguments against the cpp-linter-hooks README..clang-tidywas run with clang-tidy 22.1.0 on a small demo project:--verify-configreports no errors, a finding ininclude/is reported and the same finding inthird_party/is filtered out.mkdocs build --strictpasses locally, and the repository's pre-commit hooks pass on the new file.format-revieware gone, clang-format is off (style: ''),step-summaryis on, and the fail step usesclang-tidy-checks-failed.