Commit ad02121
authored
feat(version-scanner): implement targeted namespaced ignore pragmas (#17540)
This PR implements ignore pragmas to allow granular and self-expiring
ignores to help fend off false positives in places where we need to
leave references to specific strings:
`# version-scanner: ignore-rule=rule_name:version`
### Example:
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
more specific and complicated 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.2`
We can flag a line like this to be ignored under one of the numerous
rules we have for categorizing matches (e.g `explicit_version_string`,
`dependency_requirement`, `combined_version_string`, etc.) so that it
does not trigger a false positive in the future. In this case we
detected it under the `explicit_version_string` pattern so we flag it to
be ignored under that rule, if the search is for 3.7.
`matplotlib==3.7.2 # version-scanner:
ignore-rule=explicit_version_string:3.7`
You might ask: **but what about when we need to find versions of
matplotlib so we can update references to them?**
If instead of Python, we were to search for "matplotlib 3.7.2" we would
get a match. As a non-Python match, it would be caught under the
`dependency_requirement` rule instead of the `explicit_*` rule.1 parent 8539a8c commit ad02121
2 files changed
Lines changed: 56 additions & 1 deletion
Lines changed: 50 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
151 | 201 | | |
152 | 202 | | |
153 | 203 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
217 | | - | |
| 217 | + | |
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
222 | 227 | | |
223 | 228 | | |
224 | 229 | | |
| |||
0 commit comments