Skip to content

refactor: add [CmdletBinding()] to Test-Condition, Test-TypedValue, Invoke-Logging, Convert-ToTypeValue #32

@HeyItsGilbert

Description

@HeyItsGilbert

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactorCode quality, structure, or naming

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions