-
Notifications
You must be signed in to change notification settings - Fork 395
PSAvoidUninitializedVariable flags automatic variables #192
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
Comments
Odd, getting an error trying to edit the issue. Was going to add that this could be added to @KirkMunro's issue #189. Thanks! |
Thanks @RamblingCookieMonster for reporting the issue. I think we've fixed the issue for $PSBoundParameter but I'm not sure about $Matches. Regarding #189, we will need to have a discussion about this rule within the ScriptAnalyzer team to evaluate its usefulness as well as the noise it generates. |
Sounds good! On a side note, spot checking other automatic variables from the following (incomplete) list, looks like it flags these as well. [powershell]::Create().addscript({
Get-Variable | Select -ExpandProperty Name
}).invoke() Module version 1.0.1 Thanks! Warren |
I want to add that $PSVersionTable flags this warning as well. |
Thanks everyone. We will take a look at this bug. |
Fixed with #241 |
Hi there!
My apologies if this has already been covered.
PSAvoidUninitializedVariable seems to flag automatic PowerShell variables, such as $Matches and $PSBoundParameters.
Example code:
Resulting warning:
Cheers!
The text was updated successfully, but these errors were encountered: