Skip to content

PSAvoidAssignmentToAutomaticVariable Should detect auto-vars as function parameters #1026

Description

I did this recently and needed about 30 minutes to find my bug:

function Demo
{
    Param (
    [string] $input
    )
}

You can pass everything to this parameter, no warning, no error and $input is always $null !

See here, too: #712 "New Rule Suggestion: AvoidReuseOfAutomaticVariables"

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions