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
The intent of the PossibleIncorrectUsageOfRedirectionOperator rule is to catch possible incorrect usage.
A Redirect operator in the clause of an if-statement is pretty niche.
I appreciate you're using it intentionally here, but in most cases the redirect operator is used in error - by those more familiar with other coding languages or switching coding languages frequently. I include myself as someone that has used it in error many times!
I'd, personally, resolve this in my script by first capturing the command output, then performing the check.
Summary of the new feature
As a developer I have valid Powershell code in my if-statement and I expect zero warnings but my IDE is displaying a warning:
The above code has
2> $null
highlighted with the warning:PossibleIncorrectUsageOfRedirectionOperator
.Proposed technical implementation details (optional)
Revert or redo this offending PR: #881
What is the latest version of PSScriptAnalyzer at the point of writing
How do I obtain this? The one that comes with VS Code > ms-vscode's PowerShell extension.
The text was updated successfully, but these errors were encountered: