Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Engine/SpecialVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ internal enum PreferenceVariable
internal const string PSEmailServer = "PSEmailServer";
internal const string PSDefaultParameterValues = "PSDefaultParameterValues";
internal const string PSModuleAutoLoadingPreference = "PSModuleAutoLoadingPreference";
internal const string PSNativeCommandArgumentPassing = "PSNativeCommandArgumentPassing";
internal const string pwd = "PWD";
internal const string Null = "null";
internal const string True = "true";
Expand All @@ -182,6 +183,7 @@ internal enum PreferenceVariable
PSEmailServer,
PSDefaultParameterValues,
PSModuleAutoLoadingPreference,
PSNativeCommandArgumentPassing,
pwd,
Null,
True,
Expand Down
6 changes: 6 additions & 0 deletions Tests/Rules/UseDeclaredVarsMoreThanAssignments.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ function MyFunc2() {
Should -Be 0
}

It "does not flag `$PSNativeCommandArgumentPassing variable" {
Invoke-ScriptAnalyzer -ScriptDefinition '$PSNativeCommandArgumentPassing=None' -IncludeRule $violationName | `
Get-Count | `
Should -Be 0
}

It "does not flag global variable" {
Invoke-ScriptAnalyzer -ScriptDefinition '$global:x=$null' -IncludeRule $violationName | `
Get-Count | `
Expand Down