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
{{ message }}
Repository navigation
PSUseDeclaredVarsMoreThanAssignments reported on "get-variable -include var1,var2" #1301
Trying to reverse engineer the parameter usage of a cmdlet like Get-Variable is not trivial, therefore PSSA has implemented only a simple algorithm to understand Get-Variable foo, therefore the following would be a workaround if you don't want to suppress the rule:
I get that this is not ideal and could be enhanced, but the concept of 'minimum viable' is very strong in these days. If you are a bit familiar with the AST, I'd be happy to give you a few pointers if you want to make a pull request for this?
P.S. In your case, you rather want to use the -Name instead of the -Include parameter if you want to query specific variables, -Name accepts arrays as well.
Activity
bergmeister commentedon Aug 4, 2019
Trying to reverse engineer the parameter usage of a cmdlet like
Get-Variableis not trivial, therefore PSSA has implemented only a simple algorithm to understandGet-Variable foo, therefore the following would be a workaround if you don't want to suppress the rule:I get that this is not ideal and could be enhanced, but the concept of 'minimum viable' is very strong in these days. If you are a bit familiar with the
AST, I'd be happy to give you a few pointers if you want to make a pull request for this?P.S. In your case, you rather want to use the
-Nameinstead of the-Includeparameter if you want to query specific variables,-Nameaccepts arrays as well.