ClickHouse / ClickHouse/ClickHouse
Automate `misc-include-cleaner` fixes via scheduled CI bot
- Dominant language
- C++
- Stars
- 49.9k
- Forks
- 9k
- Avg merge
- 21h 32m
- Merged PRs (30d)
- 515
Description
# Problem
We have the `misc-include-cleaner` `clang-tidy` check disabled with the comment "useful but far too many occurrences." Enabling it as a hard lint error would flood PRs with thousands of diagnostics unrelated to the author's changes. Meanwhile, include hygiene keeps degrading over time. Unused headers accumulate, missing direct includes hide behind transitive dependencies, and clean/incremental build times increase.
# Proposal
Create an automated workflow that periodically cleans up includes across the codebase and opens a PR with the results. It could work as following
1. A scheduled job runs once per week on the master branch.
2. It runs `clang-tidy --checks='-*,misc-include-cleaner' --fix` across each subfolder of `src` (to keep diff of manageable size and revertable).
3. The resulting changes are committed and pushed to a bot branch. A PR is opened automatically with a standardised title and label.
4. CI runs on that PR as usual. If it passes, a maintainer merges it. If it fails, the bot can post a comment with the failure log and the PR stays open for manual triage.
We also need to maintain a `.include-cleaner-ignore` file for known false positives.
Contributor guide
Assessment
This issue has not been assessed yet.