Skip to content

Commit 94dcf51

Browse files
committed
Raise PSProvideDefaultParameterValues for parameters outside a param block
1 parent 55919be commit 94dcf51

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Rules/ProvideDefaultParameterValue.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ public IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
5050
paramVariables.UnionWith(funcAst.Body.ParamBlock.Parameters.Select(paramAst => paramAst.Name.VariablePath.UserPath));
5151
}
5252

53+
if (funcAst.Parameters != null)
54+
{
55+
paramVariables.UnionWith(funcAst.Parameters.Select(paramAst => paramAst.Name.VariablePath.UserPath));
56+
}
57+
5358
// Iterates all VariableExpressionAst and check the command name.
5459
foreach (VariableExpressionAst varAst in varAsts)
5560
{

0 commit comments

Comments
 (0)