feat(version-scanner): generalize and enhance regex rules for dependency scanning#17574
feat(version-scanner): generalize and enhance regex rules for dependency scanning#17574chalmerlowe wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request renames the regex configuration file to regex_pattern_config.yaml, applies standard code formatting to version_scanner.py, and introduces several new generic rules for identifying dependency versions. The review feedback highlights critical issues in the newly added regex patterns that could lead to a high number of false positives. Specifically, some rules (such as dependency_flexible_version and dependency_introspection) lack the {name} placeholder, allowing them to match unrelated dependencies. Additionally, the dependency_version_constant_membership pattern is too loose and can incorrectly match minor versions, while the dependency_wildcard_generic pattern uses a greedy wildcard that can span across unrelated text on the same line.
f8d1606 to
18012ab
Compare
feat(version-scanner): Generalize and Enhance Regex Rules for Dependency Scanning
Description
This PR enhances the regex patterns used by the version scanner to identify dependency usage across the monorepo. The changes transition the scanner from highly-specific rules to a more generalized and robust set of rules applicable to any package or runtime.
Key Changes
>=,<=,==), wildcard specifications (4.x,4.*), and custom version constant assignments.__version__,importlib.metadata,packaging.version).VERSION in ["3.", "4."]).regex_config.yamltoregex_pattern_config.yamlto better reflect its purpose and updated all references across the scanner script, documentation, and tests.Impact
These enhancements improve the scanner's recall when hunting for legacy or specific dependency versions (e.g.,
protobuf 4.x) without flooding results with documentation noise.