Skip to content

Module exported variables should not be flagged with PSUseDeclaredVarsMoreThanAssignment #819

Description

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)'

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

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions