Skip to content

Module exported variables should not be flagged with PSUseDeclaredVarsMoreThanAssignment #819

@dantraMSFT

Description

@dantraMSFT

Repro: In a module, define and assign a variable then export it using Export-ModuleMember -Variable


$MyVariable = 'some value'
Export-ModuleMember -Variable MyVariable

Expected: Invoke-ScriptAnalyzer does not flag the variable as unused.
Actual:
file: 'file:MyModule.psm1'
severity: 'Warning'
message: 'The variable 'MyVariable' is assigned but never used. (PSUseDeclaredVarsMoreThanAssignments)'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions