Skip to content

Commit 48471b7

Browse files
committed
Fixed panic in some library ruleset
1 parent 8555811 commit 48471b7

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Diff for: internal/rule/rulefunction/library.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ func LibraryPropertiesNameFieldMissing() (result ruleresult.Type, output string)
312312
return ruleresult.NotRun, "Couldn't load library.properties"
313313
}
314314

315-
if projectdata.LoadedLibrary().IsLegacy {
315+
if projectdata.LoadedLibrary() != nil && projectdata.LoadedLibrary().IsLegacy {
316316
return ruleresult.Skip, "Library has legacy format"
317317
}
318318

@@ -524,7 +524,7 @@ func LibraryPropertiesVersionFieldMissing() (result ruleresult.Type, output stri
524524
return ruleresult.NotRun, "Couldn't load library.properties"
525525
}
526526

527-
if projectdata.LoadedLibrary().IsLegacy {
527+
if projectdata.LoadedLibrary() != nil && projectdata.LoadedLibrary().IsLegacy {
528528
return ruleresult.Skip, "Library has legacy format"
529529
}
530530

@@ -665,7 +665,7 @@ func LibraryPropertiesAuthorFieldMissing() (result ruleresult.Type, output strin
665665
return ruleresult.NotRun, "Couldn't load library.properties"
666666
}
667667

668-
if projectdata.LoadedLibrary().IsLegacy {
668+
if projectdata.LoadedLibrary() != nil && projectdata.LoadedLibrary().IsLegacy {
669669
return ruleresult.Skip, "Library has legacy format"
670670
}
671671

@@ -698,7 +698,7 @@ func LibraryPropertiesMaintainerFieldMissing() (result ruleresult.Type, output s
698698
return ruleresult.NotRun, "Couldn't load library.properties"
699699
}
700700

701-
if projectdata.LoadedLibrary().IsLegacy {
701+
if projectdata.LoadedLibrary() != nil && projectdata.LoadedLibrary().IsLegacy {
702702
return ruleresult.Skip, "Library has legacy format"
703703
}
704704

@@ -823,7 +823,7 @@ func LibraryPropertiesSentenceFieldMissing() (result ruleresult.Type, output str
823823
return ruleresult.NotRun, "Couldn't load library.properties"
824824
}
825825

826-
if projectdata.LoadedLibrary().IsLegacy {
826+
if projectdata.LoadedLibrary() != nil && projectdata.LoadedLibrary().IsLegacy {
827827
return ruleresult.Skip, "Library has legacy format"
828828
}
829829

@@ -861,7 +861,7 @@ func LibraryPropertiesParagraphFieldMissing() (result ruleresult.Type, output st
861861
return ruleresult.NotRun, "Couldn't load library.properties"
862862
}
863863

864-
if projectdata.LoadedLibrary().IsLegacy {
864+
if projectdata.LoadedLibrary() != nil && projectdata.LoadedLibrary().IsLegacy {
865865
return ruleresult.Skip, "Library has legacy format"
866866
}
867867

@@ -901,7 +901,7 @@ func LibraryPropertiesCategoryFieldMissing() (result ruleresult.Type, output str
901901
return ruleresult.NotRun, "Couldn't load library.properties"
902902
}
903903

904-
if projectdata.LoadedLibrary().IsLegacy {
904+
if projectdata.LoadedLibrary() != nil && projectdata.LoadedLibrary().IsLegacy {
905905
return ruleresult.Skip, "Library has legacy format"
906906
}
907907

@@ -953,7 +953,7 @@ func LibraryPropertiesURLFieldMissing() (result ruleresult.Type, output string)
953953
return ruleresult.NotRun, "Couldn't load library.properties"
954954
}
955955

956-
if projectdata.LoadedLibrary().IsLegacy {
956+
if projectdata.LoadedLibrary() != nil && projectdata.LoadedLibrary().IsLegacy {
957957
return ruleresult.Skip, "Library has legacy format"
958958
}
959959

@@ -1023,7 +1023,7 @@ func LibraryPropertiesArchitecturesFieldMissing() (result ruleresult.Type, outpu
10231023
return ruleresult.NotRun, "Couldn't load library.properties"
10241024
}
10251025

1026-
if projectdata.LoadedLibrary().IsLegacy {
1026+
if projectdata.LoadedLibrary() != nil && projectdata.LoadedLibrary().IsLegacy {
10271027
return ruleresult.Skip, "Library has legacy format"
10281028
}
10291029

0 commit comments

Comments
 (0)