no PSReviewUnusedParameter in either case.
(Perhaps some "ambiguous" or "shadowing" warning/info in the second case, but that's not the point here)
Actual behavior
(both cases)
RuleName Severity ScriptName Line Message
-------- -------- ---------- ---- -------
PSReviewUnusedParameter Warning issue.ps1 2 The parameter 'name' has been declared but not used.
Environment data
> $PSVersionTable
Name Value
---- -----
PSVersion 7.4.4
PSEdition Core
GitCommitId 7.4.4
OS Microsoft Windows 10.0.19045
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.22.0
Notes
We have several scripts that work similar to this (script-param used in "script-internal" functions) due to try-finally, try.catch, logging, or params like Endpoint-URI, Database-Name/Address,... that would not change during script execution. They are scripts, intended (and used as such) to be ran on their own, not modules. It would be horrible to read an maintain, if we had to explicitly pass all script-params to every relevant function again.
But it would still be ok if every reference had to use the $script: syntax, for strictness/debugging/maintainability/etc.
Steps to reproduce
implicit:
explicit:
both scripts work as expected.
Expected behavior
no
PSReviewUnusedParameter
in either case. (Perhaps some "ambiguous" or "shadowing" warning/info in the second case, but that's not the point here)Actual behavior
(both cases)
Environment data
Notes
We have several scripts that work similar to this (script-param used in "script-internal" functions) due to try-finally, try.catch, logging, or params like Endpoint-URI, Database-Name/Address,... that would not change during script execution. They are scripts, intended (and used as such) to be ran on their own, not modules. It would be horrible to read an maintain, if we had to explicitly pass all script-params to every relevant function again. But it would still be ok if every reference had to use the
$script:
syntax, for strictness/debugging/maintainability/etc.