Skip to content

fix: apply review feedback to cmake.default check (PR #343) - #371

Closed
neatudarius with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-code-review-comments
Closed

fix: apply review feedback to cmake.default check (PR #343)#371
neatudarius with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-code-review-comments

Conversation

Copilot AI commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Addresses all review comments from the PR #343 review thread for the cmake.default check implementation.

Changes

cmake.py

  • New check: CMakeDefaultCheck (cmake.default) — validates that the library target is built unconditionally in the root CMakeLists.txt
  • Comment 4: Convert get_cmake_parse_tree() result to list() before passing to helper methods; the iterable would otherwise be exhausted on the first pass, silently mis-evaluating subsequent checks:
    # Before
    ast_tree = self.get_cmake_parse_tree()
    # After
    ast_tree = list(self.get_cmake_parse_tree())
  • Comments 1 & 2: All type checks use isinstance(item, Command) — avoids fragile string-based type(x).__name__ comparisons
  • Comment 3: fix() follows the established pattern (logs remediation guidance, returns False); fix-inplace test is @pytest.mark.skip(reason="not implemented"), consistent with all other checks in this file
  • Add If and Option to cmake_parser.ast imports

Tests

  • Import CMakeDefaultCheck in test_cmake.py
  • Add test__cmake_default__valid, test__cmake_default__invalid, and test__cmake_default__fix_inplace (skipped)
  • Add test fixtures: valid-default-v1.txt (unconditional library), invalid-default-v1.txt (library behind OFF option), invalid-default-v2.txt (library inside if(PROJECT_IS_TOP_LEVEL))

Copilot AI review requested due to automatic review settings July 26, 2026 16:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

- 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 review requested due to automatic review settings July 26, 2026 16:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

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
Copilot AI requested a review from neatudarius July 26, 2026 16:54
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.

3 participants