Skip to content

PSAvoidAssignmentToAutomaticVariable Should detect auto-vars as function parameters #1026

Open
@ghost

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"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions