Skip to content

Commit ba212ed

Browse files
author
Kapil Borle
committed
Add null check for filename in AnalyzeDSCResource
1 parent 4f73aa8 commit ba212ed

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

Rules/UseIdenticalMandatoryParametersDSC.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,17 @@ public class UseIdenticalMandatoryParametersDSC : IDSCResourceRule
4545
/// <returns>The results of the analysis</returns>
4646
public IEnumerable<DiagnosticRecord> AnalyzeDSCResource(Ast ast, string fileName)
4747
{
48-
if (ast == null) throw new ArgumentNullException(Strings.NullAstErrorMessage);
48+
if (ast == null)
49+
{
50+
throw new ArgumentNullException(Strings.NullAstErrorMessage);
51+
}
52+
53+
if (fileName == null)
54+
{
55+
throw new ArgumentNullException(nameof(fileName));
56+
}
4957

50-
// todo write tests for same
51-
// todo update documentation
58+
// Get the keys in the corresponding mof file
5259
var keys = GetKeys(fileName);
5360

5461
// Loop through Set/Test/Get TargetResource DSC cmdlets

0 commit comments

Comments
 (0)