Open pulkownik1803 opened 8 months ago
PSScriptAnalyzer reports PSReservedParams as warning but according to the documentation it's error
function Test-Function { [CmdletBinding()] param ( # Error [Parameter()] [string] $ErrorVariable ) $ErrorVariable = 'Error' } > Invoke-ScriptAnalyzer -Path .\Test-Function.ps1
RuleName Severity ScriptName Line Message -------- -------- ---------- ---- ------- PSReservedParams Error Test-Funct 5 'Test-Function' defines the reserved common parameter ion.ps1 'ErrorVariable'.
RuleName Severity ScriptName Line Message -------- -------- ---------- ---- ------- PSReservedParams Warning Test-Funct 5 'Test-Function' defines the reserved common parameter ion.ps1 'ErrorVariable'.
> $PSVersionTable Name Value ---- ----- PSVersion 5.1.22621.2506 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.22621.2506 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 > (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() } 1.21.0
Thanks @pulkownik1803
Thanks, I think it's best to fix code like you did rather than documentation because for this rule, violations result in code that won't even run.
PSScriptAnalyzer reports PSReservedParams as warning but according to the documentation it's error
Steps to reproduce
Expected behavior
Actual behavior
Environment data