Skip to content

Commit 3604024

Browse files
author
Kapil Borle
committed
Add module manifest check in MissingModuleManifestField
1 parent 8c597d0 commit 3604024

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Rules/MissingModuleManifestField.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,15 @@ public class MissingModuleManifestField : IScriptRule
3535
/// <returns>A List of diagnostic results of this rule</returns>
3636
public IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
3737
{
38-
if (ast == null) throw new ArgumentNullException(Strings.NullAstErrorMessage);
39-
40-
if (String.Equals(System.IO.Path.GetExtension(fileName), ".psd1", StringComparison.OrdinalIgnoreCase))
38+
if (ast == null)
39+
{
40+
throw new ArgumentNullException(Strings.NullAstErrorMessage);
41+
}
42+
if (fileName == null)
43+
{
44+
yield break;
45+
}
46+
if (Helper.IsModuleManifest(fileName))
4147
{
4248
IEnumerable<ErrorRecord> errorRecords;
4349
var psModuleInfo = Helper.Instance.GetModuleManifest(fileName, out errorRecords);

0 commit comments

Comments
 (0)