Skip to content

Commit fdd1198

Browse files
committed
Don't raise PSAvoidUninitalizedVariables for parameters outside a param block
1 parent 94dcf51 commit fdd1198

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Rules/AvoidUninitializedVariable.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ public IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
7070
{
7171
paramVariables.UnionWith(funcAst.Body.ParamBlock.Parameters.Select(paramAst => paramAst.Name.VariablePath.UserPath));
7272
}
73+
74+
//don't raise the rules for parameters outside the param block
75+
if(funcAst.Parameters != null)
76+
{
77+
paramVariables.UnionWith(funcAst.Parameters.Select(paramAst => paramAst.Name.VariablePath.UserPath));
78+
}
7379

7480
// Iterates all VariableExpressionAst and check the command name.
7581
foreach (VariableExpressionAst varAst in varAsts)

0 commit comments

Comments
 (0)