Skip to content

PSUseSyntacticallyCorrectExamples doesn't understand examples using splats #2

@andyrdavidson

Description

@andyrdavidson

When testing the following code

`
function Start-Test {
<#
.SYNOPSIS
Test program

.DESCRIPTION
Test program to demonstrate ScriptAnalyzerRules doesn't accept splatted examples

.EXAMPLE
    $testSplat = @{
        'Parameter1' = "1"
    }
    Start-Test @testSplat

#>
[cmdletbinding()]
param (
    [parameter(Mandatory = $true, HelpMessage = "Parameter1")]
    [String]$Parameter1
)

Write-Host $Parameter1

}
`

using the command Invoke-ScriptAnalyzer -Path .\SplatExamples.psm1 -CustomRulePath c:\gitrepos\ScriptAnalyzerRules\Indented.CodingConventions\

the command returns

Unable to determine parameter set used by example 1 for the function Start-Test

however the splat is valid and the function works as intended

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions