Skip to content

PSShouldProcess requires boolean value #422

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
iainbrighton opened this issue Jan 6, 2016 · 1 comment
Closed

PSShouldProcess requires boolean value #422

iainbrighton opened this issue Jan 6, 2016 · 1 comment
Assignees
Milestone

Comments

@iainbrighton
Copy link

The PSShouldProcess rule in v1.2.0 is triggering with the following definition

function MyFunction {
    [CmdletBinding(SupportsShouldProcess)]    
    param ()
    if ($PSCmdlet.ShouldProcess('Test')) {

    }
}

RuleName         Severity     FileName   Line  Message
--------         --------     --------   ----  -------
PSShouldProcess  Warning      ShouldProc 1   'MyFunction' calls ShouldProcess/ShouldContinue but
                              ess.ps1        does not have the ShouldProcess attribute.

If I specify a boolean value, the warning goes away.

unction MyFunction {
    [CmdletBinding(SupportsShouldProcess = $true)]    
    param ()
    if ($PSCmdlet.ShouldProcess('Test')) {

    }
}

IMHO this is wrong as the $true value is not required?

@quoctruong
Copy link

Thanks for the report. This is fixed with #424

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

3 participants