Skip to content

build: enable clang-tidy misc-include-cleaner for include hygiene#820

Open
yadavay-amzn wants to merge 1 commit into
apache:mainfrom
yadavay-amzn:ci-73-iwyu
Open

build: enable clang-tidy misc-include-cleaner for include hygiene#820
yadavay-amzn wants to merge 1 commit into
apache:mainfrom
yadavay-amzn:ci-73-iwyu

Conversation

@yadavay-amzn

@yadavay-amzn yadavay-amzn commented Jul 6, 2026

Copy link
Copy Markdown

What

Closes #73. Enables clang-tidy's misc-include-cleaner check to enforce include hygiene.

How

Adds misc-include-cleaner to .clang-tidy. Because the project already runs clang-tidy 22 incrementally (changed-lines-only) via the cpp-linter workflow, include hygiene is now enforced on new/changed code with no additional tooling, workflow, or mapping file. IgnoreHeaders is configured for third-party headers (arrow, nanoarrow, nlohmann-json, spdlog, CRoaring, cpr) to suppress noise from vendored includes.

Notes

This supersedes the original IWYU-based approach (a separate workflow + iwyu.imp mapping + CMake option), per the review discussion with @zhjwpku: misc-include-cleaner integrates with the existing clang-tidy setup and is far lower-maintenance for the same goal.


This contribution was authored with assistance from Claude Opus 4.8, in line with the Iceberg guidelines for AI-assisted contributions (https://iceberg.apache.org/contribute/#guidelines-for-ai-assisted-contributions). All changes were reviewed and tested by the author.

@zhjwpku

zhjwpku commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Not too sure, but should we pursue LLVM include-cleaner [1]?

[1] https://clang.llvm.org/extra/clang-tidy/checks/misc/include-cleaner.html

@yadavay-amzn yadavay-amzn changed the title ci: add include-what-you-use (IWYU) job in advisory mode build: enable clang-tidy misc-include-cleaner for include hygiene Jul 6, 2026
@yadavay-amzn

Copy link
Copy Markdown
Author

Good suggestion - pivoted to misc-include-cleaner. Since the project already runs clang-tidy 22 incrementally via cpp-linter, this enforces include hygiene on changed lines with no new tooling, so I dropped the separate IWYU workflow, iwyu.imp mapping, and CMake option. Added misc-include-cleaner.IgnoreHeaders for the vendored third-party headers (arrow, nanoarrow, nlohmann, spdlog, CRoaring, cpr) to suppress noise. The diff is now just a few lines in .clang-tidy. Updated the PR title/description accordingly.

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.

[CI] Set include-what-you-use to detect unnecessary headers

2 participants