Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix UseDeclaredVarsMoreThanAssignment rule #655

Closed
wants to merge 4 commits into from

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
3 participants