Commit 8f2f928
Fix B615 false positive when revision is set via variable (#1358)
Fix B615 false positive when revision is a variable or expression
When `revision` or `commit_id` is passed as a variable, attribute,
subscript, or other non-literal expression, `get_call_arg_value()`
cannot resolve the actual value. This caused false positives because
the check treated unresolvable values as missing.
Inspect the raw AST keywords before calling `get_call_arg_value()`.
If a `revision` or `commit_id` keyword has a non-Constant value
(Name, Attribute, Subscript, Call, etc.), give the user the benefit
of the doubt and suppress the warning.
Fixes #1345
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent e27493f commit 8f2f928
2 files changed
Lines changed: 29 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
| |||
113 | 114 | | |
114 | 115 | | |
115 | 116 | | |
116 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
117 | 130 | | |
118 | 131 | | |
119 | 132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
0 commit comments