Skip to content

PSAvoidUninitializedVariable does not recognize System.Management.Automation.SwitchParameter. #179

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
imfrancisd opened this issue May 19, 2015 · 5 comments
Assignees
Milestone

Comments

@imfrancisd
Copy link

function test-switchparameter
{
    Param(
        [switch]
        $a,

        [System.Management.Automation.SwitchParameter]
        $b
    )

    #PSAvoidUninitializedVariable on $b but not $a
}
@GoodOlClint
Copy link
Contributor

This was fixed in #159

@imfrancisd
Copy link
Author

That was for the rule "avoid setting the switch parameter value to $true".

This is for the rule "initialize variable".

@GoodOlClint
Copy link
Contributor

'doh! I'm a dummy.
Just glancing at the code this one looks more complicated than the other one.

@raghushantha
Copy link
Member

Francis. Thanks for reporting the bug. We will investigate further.

@quoctruong
Copy link

Fixed with #183

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

No branches or pull requests

4 participants