Skip to content

PSUseDeclaredVarsMoreThanAssignments flagging incorrectly #684

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tysonjhayes opened this issue Dec 16, 2016 · 1 comment
Closed

PSUseDeclaredVarsMoreThanAssignments flagging incorrectly #684

tysonjhayes opened this issue Dec 16, 2016 · 1 comment

Comments

@tysonjhayes
Copy link

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.

@kapilmb
Copy link

kapilmb commented Dec 19, 2016

This issue has been raised in #636. Solving this requires some major reworking of the rule. marking it as duplicate and closing it.

@kapilmb kapilmb closed this as completed Dec 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants