chore: add fix_includes.py for include cleanup workflow#25
Conversation
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
leaves12138
left a comment
There was a problem hiding this comment.
Thanks for adding the include-cleanup helper. I found one workflow blocker compared with the upstream IWYU script behavior.
| else: | ||
| ProcessIWYUOutput(sys.stdin, files_to_modify, flags, cwd=os.getcwd()) | ||
|
|
||
| return 0 |
There was a problem hiding this comment.
This currently always returns 0, even in --dry_run mode when files would be modified. The upstream fix_includes.py returns min(process_ret, 100) for dry runs, and the help text above also documents that behavior. With this change, CI/pre-commit workflows cannot use fix_includes.py --dry_run to fail when includes need cleanup, so include drift would be silently accepted. Please keep the upstream dry-run exit-code behavior (or update the workflow/docs if a different contract is intended).
leaves12138
left a comment
There was a problem hiding this comment.
Acknowledged that this file is intended to remain a verbatim IWYU copy. Please disregard my previous dry-run exit-code comment as a blocker; preserving the upstream script unchanged is reasonable. I have no further blocking comments.
leaves12138
left a comment
There was a problem hiding this comment.
Re-reviewed the latest update. The LICENSE now lists build_support/fix_includes.py under the include-what-you-use / UIUC-NCSA notice, and preserving the imported script unchanged is fine. I have no further comments.
Purpose
Linked issue: close #TODO
Introduce
build_support/fix_includes.pyto support include cleanup and ordering workflow in build tooling.This change adds one utility script and does not modify runtime code paths.
Tests
API and Format
No impact on public API under include/ and no storage/protocol format change.
Documentation
No end-user feature introduced. This is a build/developer tooling migration.
Generative AI tooling
Generated-by: GitHub Copilot (GPT-5.3-Codex)