Skip to content

PSUseDeclaredVarsMoreThanAssignments and assigning multiple variables #2164

Description

@iRon7

Aside from the false positive issues with the PSUseDeclaredVarsMoreThanAssignments rule, it has also a false negative bug:

This concerns assigning multiple variables:

This (as the only script line), correctly reports a PSUseDeclaredVarsMoreThanAssignments volitation on $a:

$a = $null

But this doesn't:

$a, $b = $null

PSScriptAnalyzer version: 1.24.0

Name                           Value
----                           -----
PSVersion                      7.5.4
PSEdition                      Core
GitCommitId                    7.5.4
OS                             Microsoft Windows 10.0.26100
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions