You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)'
The text was updated successfully, but these errors were encountered:
@dantraMSFT
Some things will be rather difficult to do, providing a partial solution should be doable, but something like the following might not be possible via inspection (given the following m.psm1 file)
+1 on the request. A partial solution -- by which I assume you mean a simple parse to locate an export that matches an assigned but otherwise unused variable -- would work for me.
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)'
The text was updated successfully, but these errors were encountered: