Repository navigation
fix(stinkytofu): guard clang-tidy setup behind ENABLE_CLANG_TIDY - #10468
Merged
Merged
Conversation
ENABLE_CLANG_TIDY defaults to OFF, but the CMAKE_MODULE_PATH append, include(ClangTidy) and add_clang_tidy_custom_target() ran unconditionally. ClangTidy.cmake lives in the superbuild's cmake/modules, two levels above this subproject, so configuring stinkytofu depended on a path outside its own tree even with the feature disabled -- a standalone or partial checkout failed with "include could not find requested file: ClangTidy" followed by an "Unknown CMake command" error that gives no hint at the cause. Move all three inside the option guard. When clang-tidy is explicitly requested a missing module is still a hard error, which is the intended behaviour; include(... OPTIONAL) would instead defer the failure to add_clang_tidy_custom_target() with a worse message.
✅ All Checks Passed — Ready for Review
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
|
🎉 All checks passed! This PR is ready for review. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #10468 +/- ##
===========================================
- Coverage 69.18% 69.18% -0.00%
===========================================
Files 2762 2762
Lines 454772 454772
Branches 67092 67092
===========================================
- Hits 314625 314624 -1
Misses 117273 117273
- Partials 22874 22875 +1
*This pull request uses carry forward flags. Click here to find out more. 🚀 New features to boost your workflow:
|
hcman2
approved these changes
Aug 10, 2026
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.
JIRA ID : N/A
Close #10467
Motivation
ENABLE_CLANG_TIDYdefaults to OFF, but theCMAKE_MODULE_PATHappend,include(ClangTidy)andadd_clang_tidy_custom_target()all ran unconditionally.ClangTidy.cmakelives in the superbuild's top-levelcmake/modules, two levels above the subproject, so configuring stinkytofu depended on a path outside its own tree even with the feature disabled.Any checkout that does not materialise the top-level
cmake/directory fails to configure:The second error is a cascade of the first, so the reported failure is an unknown command rather than a missing file — disproportionately confusing to diagnose.
Technical Details
Moved all three statements inside
if(ENABLE_CLANG_TIDY).include(ClangTidy OPTIONAL)was deliberately not used: it would silently skip the include and defer the failure toadd_clang_tidy_custom_target()with a worse message. When clang-tidy is explicitly requested, a missing module should stay a hard error.Test Plan
Standalone configure of
shared/stinkytofuwith the guard applied, both with the option off (default) and on, checking that clang-tidy targets appear only when requested.Test Result
ninja -t targets | grep -c tidy→ 0 with the option off, 3 with it on. The original failure was reproduced before the fix on a checkout whosecmake/directory was not materialised.Not run: full stinkytofu build/test suite (configure-only change), Windows.
Submission Checklist
Risk level
None. Configure-time only, and strictly narrows when the clang-tidy block executes. With
ENABLE_CLANG_TIDY=ONbehaviour is unchanged; with it off the block simply no longer runs.