fix: apply review feedback to cmake.default check (PR #343) - #371
Closed
neatudarius with Copilot wants to merge 2 commits into
Closed
fix: apply review feedback to cmake.default check (PR #343)#371neatudarius with Copilot wants to merge 2 commits into
neatudarius with Copilot wants to merge 2 commits into
Conversation
- Add CMakeDefaultCheck class implementing cmake.default check - Import If and Option from cmake_parser.ast - Fix comment 4: convert ast_tree to list() to prevent exhausted iterators - Use isinstance() for all type checks (comments 1 & 2) - Add test data files: valid-default-v1.txt, invalid-default-v1.txt, invalid-default-v2.txt - Add cmake.default test functions to test_cmake.py
Copilot
AI
changed the title
[WIP] Fix code based on review comments
fix: apply review feedback to cmake.default check (PR #343)
Jul 26, 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.
Addresses all review comments from the PR #343 review thread for the
cmake.defaultcheck implementation.Changes
cmake.pyCMakeDefaultCheck(cmake.default) — validates that the library target is built unconditionally in the rootCMakeLists.txtget_cmake_parse_tree()result tolist()before passing to helper methods; the iterable would otherwise be exhausted on the first pass, silently mis-evaluating subsequent checks:isinstance(item, Command)— avoids fragile string-basedtype(x).__name__comparisonsfix()follows the established pattern (logs remediation guidance, returnsFalse); fix-inplace test is@pytest.mark.skip(reason="not implemented"), consistent with all other checks in this fileIfandOptiontocmake_parser.astimportsTests
CMakeDefaultCheckintest_cmake.pytest__cmake_default__valid,test__cmake_default__invalid, andtest__cmake_default__fix_inplace(skipped)valid-default-v1.txt(unconditional library),invalid-default-v1.txt(library behindOFFoption),invalid-default-v2.txt(library insideif(PROJECT_IS_TOP_LEVEL))