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
PSAvoidUsingPositionalParameters: Do not warn on AZ CLI (#1846)
* PSAvoidUsingPositionalParameters: Do not warn on AZ CLI
* Add CommandAllowList configuration and make it case insensitive
* fix failing test on Linux as az is not a script on linux and make test not depend on AZ CLI
Copy file name to clipboardExpand all lines: docs/Rules/AvoidUsingPositionalParameters.md
+21
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,27 @@ rule from being too noisy, this rule gets only triggered when there are 3 or mor
20
20
supplied. A simple example where the risk of using positional parameters is negligible, is
21
21
`Test-Path $Path`.
22
22
23
+
## Configuration
24
+
25
+
```powershell
26
+
Rules = @{
27
+
AvoidUsingPositionalParameters = @{
28
+
CommandAllowList = 'az', 'Join-Path'
29
+
Enable = $true
30
+
}
31
+
}
32
+
```
33
+
34
+
### Parameters
35
+
36
+
#### AvoidUsingPositionalParameters: string[] (Default value is 'az')
37
+
38
+
Commands to be excluded from this rule. `az` is excluded by default because starting with version 2.40.0 the entrypoint of the AZ CLI became an `az.ps1` script but this script does not have any named parameters and just passes them on using `$args` as is to the Python process that it starts, therefore it is still a CLI and not a PowerShell command.
39
+
40
+
#### Enable: bool (Default value is `$true`)
41
+
42
+
Enable or disable the rule during ScriptAnalyzer invocation.
0 commit comments