Skip to content

PSUseDeclaredVarsMoreThanAssignments flagging incorrectly #684

Closed
@tysonjhayes

Description

@tysonjhayes

I have some code that is being flagged for the rule PSUseDeclaredVarsMoreThenAssignements.

SUseDeclaredVarsMoreThanAssignment Warning      MSFT_xWebA 876   The variable 'newParts' is assigned but never used.
s                                                ppPool.psm
                                                 1

Context can be found here

Code in question:

        $newParts = @()
        1..($parts.Count -1) | ForEach-Object {
            $newParts += $parts[$_]
        }

        $newName = ($newParts -join '.')

As we can see the variable is used in a few places shortly after its creation. I am running version 1.9.0 downloaded from the gallery.

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