Skip to content

Commit 97c1473

Browse files
author
Kapil Borle
committed
Check if the found psd1 file is a module manifest
1 parent 9399fcb commit 97c1473

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

Rules/UseIdenticalMandatoryParametersDSC.cs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -270,17 +270,13 @@ private Tuple<string, Version> GetModuleInfo(string fileName)
270270

271271
private FileInfo GetModuleManifest(string fileName)
272272
{
273-
var moduleRoot = Directory.GetParent(fileName)?.Parent?.Parent;
274-
if (moduleRoot != null)
275-
{
276-
var files = moduleRoot.GetFiles("*.psd1");
277-
if (files != null && files.Length == 1)
278-
{
279-
return files[0];
280-
}
281-
}
282-
283-
return null;
273+
return Directory
274+
.GetParent(fileName)?
275+
.Parent?
276+
.Parent?
277+
.GetFiles("*.psd1")
278+
.Where(f => Helper.IsModuleManifest(f.FullName))
279+
.FirstOrDefault();
284280
}
285281
}
286282
}

0 commit comments

Comments
 (0)