Skip to content

PSUseDeclaredVarsMoreThanAssignments does not detect declared variables #832

New issue

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

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

Already on GitHub? # to your account

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

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.

[string]$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

yep

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

No branches or pull requests

3 participants