Commit 7a3c788
fix(patterns): suppress R-VER46-01/02 for ShellVersion-guarded else branches
add_actor() and remove_actor() inside `else {}` branches of
`if (ShellVersion >= 46) { new_api() } else { old_api() }` guards
are correctly version-fenced and should not be flagged.
The previous guard-pattern only detected feature-check guards
(`if (obj.remove_actor)`), missing the common ShellVersion pattern
used by caffeine and hara-hachi-bu.
Extend guard-pattern for both rules with `|\\bShellVersion\\b` and
set guard-window: 5 so the backward scan covers typical 3-4 line
if/else blocks. Add fixture and assertions verifying both rules
are suppressed on guarded code and still fire on unguarded code.
Fixes: caffeine extension.js:721,829 false positives
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent e74c508 commit 7a3c788
File tree
4 files changed
+54
-2
lines changed- rules
- tests
- fixtures/version-guard-remove-actor@test
4 files changed
+54
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
856 | 856 | | |
857 | 857 | | |
858 | 858 | | |
859 | | - | |
| 859 | + | |
| 860 | + | |
860 | 861 | | |
861 | 862 | | |
862 | 863 | | |
| |||
867 | 868 | | |
868 | 869 | | |
869 | 870 | | |
870 | | - | |
| 871 | + | |
| 872 | + | |
871 | 873 | | |
872 | 874 | | |
873 | 875 | | |
| |||
Lines changed: 34 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
473 | 473 | | |
474 | 474 | | |
475 | 475 | | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
476 | 485 | | |
477 | 486 | | |
478 | 487 | | |
| |||
0 commit comments