Skip to content

Commit

Permalink
fix functionDefinition Ast in cmdlet rule
Browse files Browse the repository at this point in the history
  • Loading branch information
Maria Romero committed May 15, 2018
1 parent 7a43c7e commit bad6594
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Rules/UseCompatibleCmdlets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,9 @@ public IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
IEnumerable<Ast> functionDefinitionAsts = ast.FindAll(testAst => testAst is FunctionDefinitionAst, true);
foreach (Ast functionDefinition in functionDefinitionAsts)
{
string function = functionDefinition.GetType().GetProperty("Name").GetValue(functionDefinition).ToString();
customCommands.Add(function);
FunctionDefinitionAst definition = (FunctionDefinitionAst)functionDefinition;
customCommands.Add(definition.Name);
}

// If we have no cmdlets to check, we can exit from this rule.
if (commandAsts.Count() == 0)
{
Expand Down

0 comments on commit bad6594

Please sign in to comment.