Skip to content

Invoke-ScriptAnalyzer does not report a parse failure in a param() block caused by a missing parameter separator comma. #2192

Description

@FabrizioMarana

Steps to reproduce

param (
    [string[]]$aszServers = @()
    [string]$fServerListFile = ""
)

Expected behaviour

Invoke-ScriptAnalyzer should report a parser-related error because the parameter list is malformed (missing comma between parameters).

Actual behaviour

PowerShell detects the syntax error:

> .\Broken.ps1

At line:2 char:29
+     [string[]]$aszServers = @()
+                             ~
Missing ')' in function parameter list.

However:

> Invoke-ScriptAnalyzer .\Broken.ps1 -Severity Error

returns nothing.

Environment data

$PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.26100.8655
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.26100.8655
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1


PSScriptAnalyzer: 1.25.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions