Skip to content

Fix false positives in CMake dependency parsing#16

Merged
Joschi3 merged 3 commits into
mainfrom
bugfix/robust_cmake_package_parsing
Jan 5, 2026
Merged

Fix false positives in CMake dependency parsing#16
Joschi3 merged 3 commits into
mainfrom
bugfix/robust_cmake_package_parsing

Conversation

@Joschi3
Copy link
Copy Markdown
Owner

@Joschi3 Joschi3 commented Jan 5, 2026

Updates the CMake parser to correctly handle advanced find_package signatures. Previously, keywords like EXACT or version numbers were often mistaken for package names.
Key Changes

  • Robust Parsing: Added logic to skip version numbers (e.g., 1.2.0) and flags like EXACT, MODULE, and GLOBAL.
  • Better Delimiters: Now properly stops parsing arguments at OPTIONAL_COMPONENTS, NAMES, and CONFIGS (previously, only COMPONENTS was handled).
  • Cleanup: Centralized constants and added type hints for better maintainability.

Example

find_package(Foo 2.0 EXACT REQUIRED)

  • Before: Detected Foo, and EXACT as dependencies.
  • After: Correctly detects Foo only.

@Joschi3 Joschi3 self-assigned this Jan 5, 2026
@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 89.74359% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
package_xml_validation/helpers/cmake_parsers.py 89.74% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

@Joschi3 Joschi3 merged commit 6d7f840 into main Jan 5, 2026
2 checks passed
@Joschi3 Joschi3 deleted the bugfix/robust_cmake_package_parsing branch January 5, 2026 18:43
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.

2 participants