PSAvoidGlobalVars should not warn when you are referencing built-in global variables #187

KirkMunro opened this Issue May 21, 2015 · 3 comments


None yet

3 participants


PowerShell defines many built-in global variables by default. When you reference one of these variables in a script or module using the "global:" scope qualifier, PSScriptAnalyzer generates a warning due to how the PSAvoidGlobalVars rules is written. When the variable is a global, built-in variable though, this warning should not be generated.

PSAvoidGlobalVars should be modified to exclude built-in, global variables that are defined by PowerShell.

@yutingc yutingc added this to the 1505 milestone May 21, 2015
@yutingc yutingc added the bug label May 21, 2015
yutingc commented May 21, 2015

Thanks @KirkMunro, we will fix this issue soon.

@yutingc yutingc self-assigned this May 21, 2015
yutingc commented Jun 9, 2015

Hi @KirkMunro, in our implementation, we have already excluded most of the built-in variables when identifying global variables. Do you know which ones we are missing?


Seems like this issue is already fixed.

@quoctruong quoctruong closed this Jun 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment