Skip to content

Commit

Permalink
Fixed panic in some library ruleset
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaglie committed Oct 2, 2024
1 parent 8555811 commit 48471b7
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions internal/rule/rulefunction/library.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ func LibraryPropertiesNameFieldMissing() (result ruleresult.Type, output string)
return ruleresult.NotRun, "Couldn't load library.properties"
}

if projectdata.LoadedLibrary().IsLegacy {
if projectdata.LoadedLibrary() != nil && projectdata.LoadedLibrary().IsLegacy {
return ruleresult.Skip, "Library has legacy format"
}

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

if projectdata.LoadedLibrary().IsLegacy {
if projectdata.LoadedLibrary() != nil && projectdata.LoadedLibrary().IsLegacy {
return ruleresult.Skip, "Library has legacy format"
}

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

if projectdata.LoadedLibrary().IsLegacy {
if projectdata.LoadedLibrary() != nil && projectdata.LoadedLibrary().IsLegacy {
return ruleresult.Skip, "Library has legacy format"
}

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

if projectdata.LoadedLibrary().IsLegacy {
if projectdata.LoadedLibrary() != nil && projectdata.LoadedLibrary().IsLegacy {
return ruleresult.Skip, "Library has legacy format"
}

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

if projectdata.LoadedLibrary().IsLegacy {
if projectdata.LoadedLibrary() != nil && projectdata.LoadedLibrary().IsLegacy {
return ruleresult.Skip, "Library has legacy format"
}

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

if projectdata.LoadedLibrary().IsLegacy {
if projectdata.LoadedLibrary() != nil && projectdata.LoadedLibrary().IsLegacy {
return ruleresult.Skip, "Library has legacy format"
}

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

if projectdata.LoadedLibrary().IsLegacy {
if projectdata.LoadedLibrary() != nil && projectdata.LoadedLibrary().IsLegacy {
return ruleresult.Skip, "Library has legacy format"
}

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

if projectdata.LoadedLibrary().IsLegacy {
if projectdata.LoadedLibrary() != nil && projectdata.LoadedLibrary().IsLegacy {
return ruleresult.Skip, "Library has legacy format"
}

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

if projectdata.LoadedLibrary().IsLegacy {
if projectdata.LoadedLibrary() != nil && projectdata.LoadedLibrary().IsLegacy {
return ruleresult.Skip, "Library has legacy format"
}

Expand Down

0 comments on commit 48471b7

Please sign in to comment.