Repository navigation
Conversation
Re-enable clang-tidy's misc-include-cleaner, scoped to standard-library headers only. Project headers under iceberg/ and all third-party headers are listed in IgnoreHeaders, so the check no longer demands a direct include for every symbol an already-included project header provides, which is the noise that led to its removal in apache#708. What remains is the class of regression seen in apache#1066: a source file drops <vector> or <memory> while still using std::vector or std::unique_ptr, and compiles only because a project header happens to pull the standard header in transitively. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
The .clang-tidy exclusions omit zlib and platform headers, allowing non-standard headers to trigger diagnostics despite the intended standard-library-only scope.
1 open issue
What changed in this PR
Re-enables misc-include-cleaner in the existing clang-tidy setup, aiming to enforce standard-library include hygiene incrementally without restoring project-header noise.
Changes:
- Enables missing- and unused-include diagnostics.
- Adds exclusions for Iceberg and third-party headers while leaving the changed-lines-only CI workflow unchanged.
| File | Description |
|---|---|
.clang-tidy |
Enables include checking and configures header exclusions intended to limit diagnostics to standard-library headers. |
Review effort: Balanced
| # not demand a direct include for every symbol that an already-included | ||
| # project header provides (the noise that led to its removal in #708). | ||
| - key: misc-include-cleaner.IgnoreHeaders | ||
| value: 'iceberg/.*;arrow/.*;avro/.*;aws/.*;benchmark/.*;cpr/.*;curl/.*;gmock/.*;gtest/.*;nanoarrow/.*;nlohmann/.*;openssl/.*;parquet/.*;roaring/.*;spdlog/.*;sqlpp23/.*;thrift/.*;libpq-fe\.h;mysql\.h;sqlite3\.h;utf8proc\.h;zlib\.h' |
This branch has not been deployed
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.

What
Re-enables clang-tidy's
misc-include-cleaner, scoped to standard-library headers only.Why
#820 enabled the check unscoped and #708 removed it five days later because it demanded a direct include for every project symbol (
iceberg::Result,iceberg::Status, ...) that an already-included project header provides, which blocked CI with long include lists. Since then nothing checks includes, and review of #1066 found regressions of this shape:history_table.ccdrops<vector>but still usesstd::vector, and the newmetadata_scan.ccusesstd::vector,std::shared_ptr,std::unique_ptr,std::stringandstd::make_uniquewithout<vector>,<memory>or<string>. Both compile only becausemetadata_scan.hhappens to include those headers.How
misc-include-cleaner.IgnoreHeaderslistsiceberg/.*and every third-party header family, so the only diagnostics left are:std::symbol (orint64_t,size_t, ...) used without a direct include of its standard headerWith cpp-linter already running clang-tidy 22 on changed lines, this needs no new workflow or tooling.
Measured on
mainRunning the scoped check over every library and test source with the same clang-tidy version CI uses (22.1.8):
Unscoped, the check would emit all 4922; scoped, the project-header half disappears entirely.
The pre-existing standard-library gaps are not fixed here. Because
cpp-linterruns with--lines-changed-only=true, they only surface on lines a PR touches, so the codebase converges incrementally and this PR stays a config-only change. A one-shot cleanup withclang-tidy --fixis possible as a follow-up if preferred.Verified against #1066
Running the new config on that branch reports the missing
<vector>inhistory_table.ccand the five missing standard headers inmetadata_scan.cc, and nothing else in those files. One caveat: thestd::vectoruse inhistory_table.ccis on a line #1066 did not change, so CI's changed-lines mode would report only themetadata_scan.ccfindings. Catching include removals whose use sites are untouched would require whole-file linting of changed files, which is a separate decision.🤖 Generated with Claude Code