Add diff-scoped clang-tidy CI workflow#117
Conversation
The .clang-tidy ruleset was configured but never executed in CI; this runs clang-tidy-diff.py over changed lines on PRs, reusing the preset's exported compile_commands.json.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #117 +/- ##
=======================================
Coverage 75.17% 75.17%
=======================================
Files 25 25
Lines 2908 2908
Branches 393 393
=======================================
Hits 2186 2186
Misses 722 722
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6a83263d86
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The diff glob matches src/mlir/*.cpp, but the debug preset omits src/mlir (opt-in behind NORA_ENABLE_MLIR, MLIR/TableGen deps not installed), so those files are not in compile_commands.json. Without -only-check-in-db, clang-tidy-diff.py lints them with no compile command and fails on missing mlir/IR/... and generated .inc headers, blocking any MLIR-only PR. The flag restricts the lint to files present in the database while still linting normal src/*.cpp changes.
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
Summary
Adds
.github/workflows/clang-tidy.yml, closing the most concrete gap from thetooling audit in #116:
.clang-tidyandCMAKE_EXPORT_COMPILE_COMMANDS=ONwerealready configured, but no workflow ever ran the linter, so the ruleset only
affected local editors.
The job:
main(paths-filtered to C/C++ sources,.clang-tidy, and theworkflow itself), mirroring the structure of
scan-build.yml.debugpreset withclang-22/clang++-22so the exportedcompile_commands.jsoncarries Clang-compatible flags — configuring with GCCleaks GCC-only warning options that clang-tidy rejects as
unknown-warning-optionerrors. Configure alone is enough (it also generatesconfig.h); no build step is needed for a lint pass.clang-tidy-diff.py(git diff -U0 origin/<base>...HEAD), so the existing ruleset applies to new/modified codewithout drowning PRs in pre-existing findings from unchanged code.
-warnings-as-errors='*'so any finding on a changed line fails the jobvia the script's exit code (verified it respects the line filter — a clean
changed line in a file with hundreds of pre-existing warnings still passes).
Scope
#116 is an audit bundling several independent recommendations. This PR
intentionally addresses only the clang-tidy CI item so it stays small and
reviewable, hence
Part of #116rather than a closing keyword — the issue shouldremain open for the remaining follow-ups:
clang-tidypre-commit hookPart of #116
Test plan
cmake --preset debug(clang) generatesbuild/debug/compile_commands.jsonorigin/main...HEADfor this PR → no C/C++changes, exit 0 (job will be green)