feat(version-scanner): implement targeted namespaced ignore pragmas#17540
Draft
chalmerlowe wants to merge 1 commit into
Draft
feat(version-scanner): implement targeted namespaced ignore pragmas#17540chalmerlowe wants to merge 1 commit into
chalmerlowe wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request adds support for targeted rule ignoring in the version scanner using the version-scanner: ignore-rule=<rule_name>:<version> pragma, along with corresponding unit tests. Feedback was provided to convert the version value to a string before calling re.escape to avoid potential runtime TypeError exceptions if a non-string version (such as a float or integer) is specified in the rule configuration.
04f3d2d to
69e81ab
Compare
64367eb to
23b8ef3
Compare
69e81ab to
111c152
Compare
23b8ef3 to
031be67
Compare
111c152 to
055975c
Compare
031be67 to
8abd504
Compare
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.
This PR implements ignore pragmas to allow granular and self-expiring ignores:
# version-scanner: ignore-rule=rule_name:versionExamples:
Imagine searching for "Python 3.7". We have a variety of rules to cover multiple circumstances. One rule matches solely on the version number (e.g. "3.7" in case the reference is an edge case not covered by other rules).
Thus if we find "3.7" in a situation unrelated to Python, we will have a false positive such as this:
matplotlib==3.7.2We can flag a line like this to be ignored under the specific rule
explicit_version_stringso that it does not trigger a false positive in the future.matplotlib==3.7.2 # version-scanner: ignore-rule=explicit_version_string:3.7NOTE: if instead of Python, we were to search for "matplotlib 3.7.2" because this pragma is specific to a rule and a version number this line would be caught under a different rule: specifically: the
dependency_requirementrule:dependency_requirementrules apply when you search for a specific dependency that is not Python. Here are some lines that would be assessed against dependency specific rules.matplotlib==3.7.2protobuf==2.48.5requests==4.3.1