Skip to content

[Code Quality] setup/publish.ps1 — Docstring example uses -fm but actual parameter is -Tfm #773

@Christophe-Rogiers

Description

@Christophe-Rogiers

Severity: Info

Location: setup/publish.ps1:26 (docstring) vs :37 (param)

Code:

<#
...
.EXAMPLE
    PS> .\publish.ps1 -fm "net10.0" -version "3.8"
...
#>

param(
    [string]$Tfm      = "net10.0-windows",
    [ValidatePattern("^\d+\.\d+$")]
    [string]$Version = "8.1"
)

Explanation:
The .EXAMPLE section of the comment-based help uses -fm "net10.0", but the real parameter is -Tfm. PowerShell's prefix-matching will accept -fm as an unambiguous shortening of -Tfm only as long as no other parameter starts with fm — today that is the case, so the example happens to work, but a reader copy-pasting from Get-Help .\publish.ps1 -Examples will be confused if prefix matching ever becomes ambiguous or is disabled.

Suggested fix:
Update the docstring to match the parameter name:

.EXAMPLE
    PS> .\publish.ps1 -Tfm "net10.0" -Version "3.8"

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions