Skip to content

Require compile context for clang-tidy#25

Merged
cgraf78 merged 1 commit into
mainfrom
fix/clang-tidy-require-compile-context
Jun 30, 2026
Merged

Require compile context for clang-tidy#25
cgraf78 merged 1 commit into
mainfrom
fix/clang-tidy-require-compile-context

Conversation

@cgraf78

@cgraf78 cgraf78 commented Jun 30, 2026

Copy link
Copy Markdown
Owner

Require clang-tidy to have generic C/C++ compile context before Checkrun plans or runs it.

.clang-tidy configures rule selection, but it does not provide compiler arguments. The registry now gates clang-tidy on compile_commands.json or compile_flags.txt, while fast lint and verify still pass nearby .clang-tidy as --config-file after compile context exists.

Testing:

  • ./bin/checkrun format README.md lib/checkrun/verify.py lib/checkrun/linters/languages.sh share/checkrun/registry.json test/suites/autolint-test test/suites/registry-test test/suites/verify-test
  • ./bin/checkrun lint README.md lib/checkrun/verify.py lib/checkrun/linters/languages.sh share/checkrun/registry.json test/suites/autolint-test test/suites/registry-test test/suites/verify-test
  • test/suites/registry-test
  • test/suites/verify-test
  • test/suites/autolint-test
  • test/checkrun-test

Summary

Require generic C/C++ compile context before Checkrun plans or runs
`clang-tidy`.

`.clang-tidy` configures rule selection, but it does not provide the compiler
arguments needed for a meaningful standalone `clang-tidy` invocation. Treating
it as an enablement signal made Checkrun run raw `clang-tidy` in repos that
provide their C++ compiler context through another toolchain.

- use `compile_commands.json` and `compile_flags.txt` as the `clang-tidy`
  registry gate
- keep `.clang-tidy` as an optional `--config-file` when compile context exists
- update fast lint and verify-time adapters to share the same rule
- cover `.clang-tidy`-only, compile-database, compile-flags, and combined
  config cases

Testing

- `./bin/checkrun format README.md lib/checkrun/verify.py lib/checkrun/linters/languages.sh share/checkrun/registry.json test/suites/autolint-test test/suites/registry-test test/suites/verify-test`
- `./bin/checkrun lint README.md lib/checkrun/verify.py lib/checkrun/linters/languages.sh share/checkrun/registry.json test/suites/autolint-test test/suites/registry-test test/suites/verify-test`
- `test/suites/registry-test`
- `test/suites/verify-test`
- `test/suites/autolint-test`
- `test/checkrun-test`
@cgraf78 cgraf78 merged commit 5a280c9 into main Jun 30, 2026
6 checks passed
@cgraf78 cgraf78 deleted the fix/clang-tidy-require-compile-context branch June 30, 2026 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant