PowerShell / PSScriptAnalyzer

Download ScriptAnalyzer from PowerShellGallery
https://www.powershellgallery.com/packages/PSScriptAnalyzer/
MIT License
1.85k stars 373 forks source link

AvoidUsingPositionalParameters is flagging simple "echo"s #1899

Open TWiStErRob opened 1 year ago

TWiStErRob commented 1 year ago

Steps to reproduce

Write-Host Done with projects.

Expected behavior

To prevent this rule from being too noisy, this rule gets only triggered when there are 3 or more parameters supplied.

https://github.com/PowerShell/PSScriptAnalyzer/blob/1.21.0/docs/Rules/AvoidUsingPositionalParameters.md#description

Actual behavior

image

Environment data

Can't, I'm using GitHub Actions. They claim 1.21.0: https://github.com/actions/runner-images/blob/main/images/win/Windows2022-Readme.md#powershell-modules

SydneyhSmith commented 1 year ago

@TWiStErRob looks like you may be missing quotes around "Done with projects." this should resolve the issue since it is being read as three positional parameters rather than one

TWiStErRob commented 1 year ago

Huh, that makes sense, but it's still a false positive, right?