You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
UseProcessBlockForPipelineCommand returns a warning when pipeline behavior is explicitly disabled #1725
RuleName Severity ScriptName Line Message
-------- -------- ---------- ---- -------
PSUseProcessBlockForPipelineCommand Warning Test-PSSA. 8 Command accepts pipeline input but has not defined a
ps1 process block.
Environment data
>$PSVersionTable
Name Value
---------
PSVersion 7.1.3
PSEdition Core
GitCommitId 7.1.3
OS Microsoft Windows 10.0.19042
Platform Win32NT
PSCompatibleVersions {1.0,2.0,3.0,4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0> (Get-Module-ListAvailable PSScriptAnalyzer).Version |ForEach-Object { $_.ToString() }
1.19.11.20.0
It looks like it currently operates on the assumption that specifying the attribute is always going to be activating it, so the code should instead actually check the value and only issue a warning if it's true or a value isn't given (since that defaults to true in PowerShell with boolean attribute parameters).
Activity
rjmholt commentedon Oct 12, 2021
I haven't verified this, but looking at the code I think it's a bit naive and should be fixed to look at the value:
PSScriptAnalyzer/Rules/UseProcessBlockForPipelineCommand.cs
Lines 48 to 49 in 359f98f
It looks like it currently operates on the assumption that specifying the attribute is always going to be activating it, so the code should instead actually check the value and only issue a warning if it's true or a value isn't given (since that defaults to true in PowerShell with boolean attribute parameters).