Summary
Four functions are missing [CmdletBinding()], creating inconsistency and, in two cases, subtle functional issues.
Files and Issues
| File |
Problem |
Public/Test-Condition.ps1 |
Only public function without [CmdletBinding()]; no -Verbose/-ErrorAction support |
Private/Test-TypedValue.ps1 |
Uses $PSCmdlet.ParameterSetName without [CmdletBinding()] — works accidentally |
Private/Invoke-Logging.ps1 |
Has begin/process blocks without [CmdletBinding()] — blocks have no pipeline effect |
Private/Convert-ToTypeValue.ps1 |
Missing for consistency; no other functional issue |
Fix
Add [CmdletBinding()] before the param block in each function.
function Test-Condition {
[CmdletBinding()]
param (
...
)
}
Notes
- PSScriptAnalyzer does not currently flag this (the rule isn't enabled by default for all these cases)
- Found by Brent Tlackburn
Summary
Four functions are missing
[CmdletBinding()], creating inconsistency and, in two cases, subtle functional issues.Files and Issues
Public/Test-Condition.ps1[CmdletBinding()]; no-Verbose/-ErrorActionsupportPrivate/Test-TypedValue.ps1$PSCmdlet.ParameterSetNamewithout[CmdletBinding()]— works accidentallyPrivate/Invoke-Logging.ps1begin/processblocks without[CmdletBinding()]— blocks have no pipeline effectPrivate/Convert-ToTypeValue.ps1Fix
Add
[CmdletBinding()]before theparamblock in each function.Notes