Skip to content

PSUseDeclaredVarsMoreThanAssignments does not detect variables with multiple assignments #833

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

Closed
JohnLBevan opened this issue Nov 24, 2017 · 4 comments

Comments

@JohnLBevan
Copy link

PSScriptAnalyzer correctly displays PSUseDeclaredVarsMoreThanAssignments given the following code:

$someVariable = 'some value'

However, we can prevent this by declaring a type for variable a type. e.g.

$someVariable = 'some value'
$someVariable = 'some value'
@bergmeister
Copy link
Collaborator

Thanks for reporting the case. However, it is a known issue that PSUseDeclaredVarsMoreThanAssignments can produce false positives for more than a year and there are several similar issues in this repo already. Given the low ressources on this project from the Microsoft side at the moment, it might take quite some time until PSUseDeclaredVarsMoreThanAssignments get fixed. Nevertheless it is still good to have all use cases collateted to help testing it should someone step into doing this ambitious task.

@bergmeister
Copy link
Collaborator

@JamesWTruher Can we consider closing this now that the PR is merged?

@JamesWTruher
Copy link
Contributor

definitely - I would rather @JohnLBevan do it (as he opened the issue). On the other hand, if you as the fixer want to close it, that's also fine.

@bergmeister
Copy link
Collaborator

@JamesWTruher Although it would be great if the person raising this issue can sign this off, I do not think we can assume that everyone knows or has the time to compile PSSA themselves. I myself do not have rights to close issues as a community member...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants