Skip to content

Proposed fix for #473 #474

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 29, 2016
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
9 changes: 5 additions & 4 deletions Engine/Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ internal set
/// </summary>
private Dictionary<Ast, VariableAnalysis> 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

Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -3022,4 +3023,4 @@ public object VisitUsingExpression(UsingExpressionAst usingExpressionAst)
return null;
}
}
}
}
15 changes: 15 additions & 0 deletions Tests/Rules/GoodCmdlet.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,21 @@ function global:Get-SimpleFunc*

}

function Local:Get-SimpleFunc*
{

}

function PRIVATE:Get-SimpleFunc*
{

}

function ScRiPt:Get-SimpleFunc*
{

}

<#
.Synopsis
Short description
Expand Down