Skip to content

Commit 78ee946

Browse files
authored
Exclude PSNativeCommandArgumentPassing variable (#2093)
* Exclude PSNativeCommandArgumentPassing variable * Update UseDeclaredVarsMoreThanAssignments.tests.ps1 * Add missing comma in SpecialVars.cs
1 parent 2287a13 commit 78ee946

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Diff for: Engine/SpecialVars.cs

+2
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ internal enum PreferenceVariable
160160
internal const string PSEmailServer = "PSEmailServer";
161161
internal const string PSDefaultParameterValues = "PSDefaultParameterValues";
162162
internal const string PSModuleAutoLoadingPreference = "PSModuleAutoLoadingPreference";
163+
internal const string PSNativeCommandArgumentPassing = "PSNativeCommandArgumentPassing";
163164
internal const string pwd = "PWD";
164165
internal const string Null = "null";
165166
internal const string True = "true";
@@ -182,6 +183,7 @@ internal enum PreferenceVariable
182183
PSEmailServer,
183184
PSDefaultParameterValues,
184185
PSModuleAutoLoadingPreference,
186+
PSNativeCommandArgumentPassing,
185187
pwd,
186188
Null,
187189
True,

Diff for: Tests/Rules/UseDeclaredVarsMoreThanAssignments.tests.ps1

+6
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ function MyFunc2() {
5858
Should -Be 0
5959
}
6060

61+
It "does not flag `$PSNativeCommandArgumentPassing variable" {
62+
Invoke-ScriptAnalyzer -ScriptDefinition '$PSNativeCommandArgumentPassing=None' -IncludeRule $violationName | `
63+
Get-Count | `
64+
Should -Be 0
65+
}
66+
6167
It "does not flag global variable" {
6268
Invoke-ScriptAnalyzer -ScriptDefinition '$global:x=$null' -IncludeRule $violationName | `
6369
Get-Count | `

0 commit comments

Comments
 (0)