Commit 6a8e828
Fix PSUseDeclaredVarsMoreThanAssignments to not give false positives when using += operator (#935)
* fix false positives such as '$a=@(); $b | foreach-object { $a+=$c}' because the rule misunderstood += as assignment
* add test (it turns out a regression happened for 'flags strongly typed variables'
* fix regression for strongly typed variables by being more selective about the if/else decision
* add additional test case for unassigned variable1 parent 2427610 commit 6a8e828
2 files changed
Lines changed: 22 additions & 2 deletions
File tree
- Rules
- Tests/Rules
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | | - | |
| 176 | + | |
177 | 177 | | |
178 | | - | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
179 | 189 | | |
180 | 190 | | |
181 | 191 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
76 | 86 | | |
77 | 87 | | |
0 commit comments