Skip to content

Commit 81faef8

Browse files
committed
Don't run checks for required library.properties fields on legacy libs
The checks for library.properties field formatting are skipped if the field is not present, but that was not possible with the required fields, since that is exactly what is being checked. So the checks should only be skipped if there is no library.properties at all.
1 parent 4da8e29 commit 81faef8

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

check/checkfunctions/library.go

+36
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ func LibraryPropertiesNameFieldMissing() (result checkresult.Type, output string
114114
return checkresult.NotRun, "Couldn't load library.properties"
115115
}
116116

117+
if checkdata.LoadedLibrary().IsLegacy {
118+
return checkresult.NotRun, "Library has legacy format"
119+
}
120+
117121
if schema.RequiredPropertyMissing("name", checkdata.LibraryPropertiesSchemaValidationResult()[compliancelevel.Specification], configuration.SchemasPath()) {
118122
return checkresult.Fail, ""
119123
}
@@ -343,6 +347,10 @@ func LibraryPropertiesVersionFieldMissing() (result checkresult.Type, output str
343347
return checkresult.NotRun, "Couldn't load library.properties"
344348
}
345349

350+
if checkdata.LoadedLibrary().IsLegacy {
351+
return checkresult.NotRun, "Library has legacy format"
352+
}
353+
346354
if schema.RequiredPropertyMissing("version", checkdata.LibraryPropertiesSchemaValidationResult()[compliancelevel.Specification], configuration.SchemasPath()) {
347355
return checkresult.Fail, ""
348356
}
@@ -484,6 +492,10 @@ func LibraryPropertiesAuthorFieldMissing() (result checkresult.Type, output stri
484492
return checkresult.NotRun, "Couldn't load library.properties"
485493
}
486494

495+
if checkdata.LoadedLibrary().IsLegacy {
496+
return checkresult.NotRun, "Library has legacy format"
497+
}
498+
487499
if schema.RequiredPropertyMissing("author", checkdata.LibraryPropertiesSchemaValidationResult()[compliancelevel.Specification], configuration.SchemasPath()) {
488500
return checkresult.Fail, ""
489501
}
@@ -513,6 +525,10 @@ func LibraryPropertiesMaintainerFieldMissing() (result checkresult.Type, output
513525
return checkresult.NotRun, "Couldn't load library.properties"
514526
}
515527

528+
if checkdata.LoadedLibrary().IsLegacy {
529+
return checkresult.NotRun, "Library has legacy format"
530+
}
531+
516532
if schema.RequiredPropertyMissing("maintainer", checkdata.LibraryPropertiesSchemaValidationResult()[compliancelevel.Specification], configuration.SchemasPath()) {
517533
return checkresult.Fail, ""
518534
}
@@ -616,6 +632,10 @@ func LibraryPropertiesSentenceFieldMissing() (result checkresult.Type, output st
616632
return checkresult.NotRun, "Couldn't load library.properties"
617633
}
618634

635+
if checkdata.LoadedLibrary().IsLegacy {
636+
return checkresult.NotRun, "Library has legacy format"
637+
}
638+
619639
if schema.RequiredPropertyMissing("sentence", checkdata.LibraryPropertiesSchemaValidationResult()[compliancelevel.Specification], configuration.SchemasPath()) {
620640
return checkresult.Fail, ""
621641
}
@@ -650,6 +670,10 @@ func LibraryPropertiesParagraphFieldMissing() (result checkresult.Type, output s
650670
return checkresult.NotRun, "Couldn't load library.properties"
651671
}
652672

673+
if checkdata.LoadedLibrary().IsLegacy {
674+
return checkresult.NotRun, "Library has legacy format"
675+
}
676+
653677
if schema.RequiredPropertyMissing("paragraph", checkdata.LibraryPropertiesSchemaValidationResult()[compliancelevel.Specification], configuration.SchemasPath()) {
654678
return checkresult.Fail, ""
655679
}
@@ -686,6 +710,10 @@ func LibraryPropertiesCategoryFieldMissing() (result checkresult.Type, output st
686710
return checkresult.NotRun, "Couldn't load library.properties"
687711
}
688712

713+
if checkdata.LoadedLibrary().IsLegacy {
714+
return checkresult.NotRun, "Library has legacy format"
715+
}
716+
689717
if schema.RequiredPropertyMissing("category", checkdata.LibraryPropertiesSchemaValidationResult()[compliancelevel.Specification], configuration.SchemasPath()) {
690718
return checkresult.Fail, ""
691719
}
@@ -734,6 +762,10 @@ func LibraryPropertiesUrlFieldMissing() (result checkresult.Type, output string)
734762
return checkresult.NotRun, "Couldn't load library.properties"
735763
}
736764

765+
if checkdata.LoadedLibrary().IsLegacy {
766+
return checkresult.NotRun, "Library has legacy format"
767+
}
768+
737769
if schema.RequiredPropertyMissing("url", checkdata.LibraryPropertiesSchemaValidationResult()[compliancelevel.Specification], configuration.SchemasPath()) {
738770
return checkresult.Fail, ""
739771
}
@@ -788,6 +820,10 @@ func LibraryPropertiesArchitecturesFieldMissing() (result checkresult.Type, outp
788820
return checkresult.NotRun, "Couldn't load library.properties"
789821
}
790822

823+
if checkdata.LoadedLibrary().IsLegacy {
824+
return checkresult.NotRun, "Library has legacy format"
825+
}
826+
791827
if schema.RequiredPropertyMissing("architectures", checkdata.LibraryPropertiesSchemaValidationResult()[compliancelevel.Specification], configuration.SchemasPath()) {
792828
return checkresult.Fail, ""
793829
}

0 commit comments

Comments
 (0)