Skip to content

Conversation

@kapilmb
Copy link

@kapilmb kapilmb commented Nov 17, 2016

Consider the following case:

$a = 1
1..5 | ForEach-Object {$a = 2}
$a

In this case, the rule would flag the assignment in the ForEach-Object block. This commit fixes this issue.

Resolves #636


This change is Reviewable

Kapil Borle added 4 commits November 15, 2016 20:09
Consider the following case:
```powershell
$a = 1
1..5 | ForEach-Object {$a = 2}
$a
```

In this case, the rule would flag the assignement in the `ForEach-Object` block. This commit fixes this issue.
@kapilmb
Copy link
Author

kapilmb commented Nov 8, 2017

Closing this issue because the changes in the PR is mere patchwork and does not handle variable data flow problems uniformly. A better approach to the problem would be to apply the techniques used in the VariableAnalysis class.

@kapilmb kapilmb closed this Nov 8, 2017
@kapilmb kapilmb deleted the kapilmb/FixUseDeclaredVars branch November 8, 2017 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Question about 'PSUseDeclaredVarsMoreThanAssignment' rule

4 participants