Skip to content

PSUseDeclaredVarsMoreThanAssignments does not detect variables with multiple assignments #833

Closed

Description

PSScriptAnalyzer correctly displays PSUseDeclaredVarsMoreThanAssignments given the following code:

$someVariable = 'some value'

However, we can prevent this by declaring a type for variable a type. e.g.

$someVariable = 'some value'
$someVariable = 'some value'

Activity

  1. bergmeister commented on Dec 2, 2017

    @bergmeister
    Collaborator

    Thanks for reporting the case. However, it is a known issue that PSUseDeclaredVarsMoreThanAssignments can produce false positives for more than a year and there are several similar issues in this repo already. Given the low ressources on this project from the Microsoft side at the moment, it might take quite some time until PSUseDeclaredVarsMoreThanAssignments get fixed. Nevertheless it is still good to have all use cases collateted to help testing it should someone step into doing this ambitious task.

  2. bergmeister commented on Jan 20, 2018

    @bergmeister
    Collaborator

    James Truher (@JamesWTruher) Can we consider closing this now that the PR is merged?

  3. JamesWTruher commented on Jan 22, 2018

    @JamesWTruher
    Contributor

    definitely - I would rather John Bevan (@JohnLBevan) do it (as he opened the issue). On the other hand, if you as the fixer want to close it, that's also fine.

  4. bergmeister commented on Jan 22, 2018

    @bergmeister
    Collaborator

    James Truher (@JamesWTruher) Although it would be great if the person raising this issue can sign this off, I do not think we can assume that everyone knows or has the time to compile PSSA themselves. I myself do not have rights to close issues as a community member...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions