diff --git a/Engine/Helper.cs b/Engine/Helper.cs index 6ba8556b1..08d324028 100644 --- a/Engine/Helper.cs +++ b/Engine/Helper.cs @@ -100,9 +100,9 @@ internal set /// private Dictionary VariableAnalysisDictionary; - private string[] functionScopes = new string[] { "global:", "local:", "script:", "private:" }; + private string[] functionScopes = new string[] { "global:", "local:", "script:", "private:"}; - private string[] variableScopes = new string[] { "global:", "local:", "script:", "private:", "variable:", ":" }; + private string[] variableScopes = new string[] { "global:", "local:", "script:", "private:", "variable:", ":"}; #endregion @@ -419,7 +419,8 @@ private string NameWithoutScope(string name, string[] scopes) foreach (string scope in scopes) { // trim the scope part - if (name.IndexOf(scope) == 0) + if (name.IndexOf(scope, StringComparison.OrdinalIgnoreCase) == 0) + { return name.Substring(scope.Length); } @@ -3022,4 +3023,4 @@ public object VisitUsingExpression(UsingExpressionAst usingExpressionAst) return null; } } -} \ No newline at end of file +} diff --git a/Tests/Rules/GoodCmdlet.ps1 b/Tests/Rules/GoodCmdlet.ps1 index 2c9d552b0..d4d6526da 100644 --- a/Tests/Rules/GoodCmdlet.ps1 +++ b/Tests/Rules/GoodCmdlet.ps1 @@ -223,6 +223,21 @@ function global:Get-SimpleFunc* } +function Local:Get-SimpleFunc* +{ + +} + +function PRIVATE:Get-SimpleFunc* +{ + +} + +function ScRiPt:Get-SimpleFunc* +{ + +} + <# .Synopsis Short description