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
Enhance UseDeclaredVarsMoreThanAssignments to detect also take into account the usage of Get-Variable with an array of variables and usage of named parameter -Name (#1310)
* Parse Array syntax of Get-Variable
* check named parameter better to be -Name or shortened versions and add more tests
* Fix last edge cases and refactor into method
* Apply PR suggestions: Use shorter pattern matching syntax and inline/simplify local method
It "Using a variable via 'Get-Variable' does not trigger a warning" {
92
-
$noViolations=Invoke-ScriptAnalyzer-ScriptDefinition '$a=4; get-variable a'
93
-
$noViolations.Count| Should -Be 0
91
+
It "No warning when using 'Get-Variable' with variables declaration '<DeclareVariables>' and command parameter <GetVariableCommandParameter>"-TestCases @(
0 commit comments