@@ -110,8 +110,9 @@ func RedundantLibraryProperties() (result checkresult.Type, output string) {
110
110
111
111
// LibraryPropertiesNameFieldMissing checks for missing library.properties "name" field.
112
112
func LibraryPropertiesNameFieldMissing () (result checkresult.Type , output string ) {
113
- if checkdata .LibraryPropertiesLoadError () != nil {
114
- return checkresult .NotRun , "Couldn't load library.properties"
113
+ shouldRun , reason := runRequiredLibraryPropertiesFieldCheck ()
114
+ if ! shouldRun {
115
+ return checkresult .NotRun , reason
115
116
}
116
117
117
118
if schema .RequiredPropertyMissing ("name" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
@@ -339,8 +340,9 @@ func LibraryPropertiesNameFieldHeaderMismatch() (result checkresult.Type, output
339
340
340
341
// LibraryPropertiesVersionFieldMissing checks for missing library.properties "version" field.
341
342
func LibraryPropertiesVersionFieldMissing () (result checkresult.Type , output string ) {
342
- if checkdata .LibraryPropertiesLoadError () != nil {
343
- return checkresult .NotRun , "Couldn't load library.properties"
343
+ shouldRun , reason := runRequiredLibraryPropertiesFieldCheck ()
344
+ if ! shouldRun {
345
+ return checkresult .NotRun , reason
344
346
}
345
347
346
348
if schema .RequiredPropertyMissing ("version" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
@@ -480,8 +482,9 @@ func LibraryPropertiesVersionFieldBehindTag() (result checkresult.Type, output s
480
482
481
483
// LibraryPropertiesAuthorFieldMissing checks for missing library.properties "author" field.
482
484
func LibraryPropertiesAuthorFieldMissing () (result checkresult.Type , output string ) {
483
- if checkdata .LibraryPropertiesLoadError () != nil {
484
- return checkresult .NotRun , "Couldn't load library.properties"
485
+ shouldRun , reason := runRequiredLibraryPropertiesFieldCheck ()
486
+ if ! shouldRun {
487
+ return checkresult .NotRun , reason
485
488
}
486
489
487
490
if schema .RequiredPropertyMissing ("author" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
@@ -509,8 +512,9 @@ func LibraryPropertiesAuthorFieldLTMinLength() (result checkresult.Type, output
509
512
510
513
// LibraryPropertiesMaintainerFieldMissing checks for missing library.properties "maintainer" field.
511
514
func LibraryPropertiesMaintainerFieldMissing () (result checkresult.Type , output string ) {
512
- if checkdata .LibraryPropertiesLoadError () != nil {
513
- return checkresult .NotRun , "Couldn't load library.properties"
515
+ shouldRun , reason := runRequiredLibraryPropertiesFieldCheck ()
516
+ if ! shouldRun {
517
+ return checkresult .NotRun , reason
514
518
}
515
519
516
520
if schema .RequiredPropertyMissing ("maintainer" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
@@ -612,8 +616,9 @@ func LibraryPropertiesEmailFieldStartsWithArduino() (result checkresult.Type, ou
612
616
613
617
// LibraryPropertiesSentenceFieldMissing checks for missing library.properties "sentence" field.
614
618
func LibraryPropertiesSentenceFieldMissing () (result checkresult.Type , output string ) {
615
- if checkdata .LibraryPropertiesLoadError () != nil {
616
- return checkresult .NotRun , "Couldn't load library.properties"
619
+ shouldRun , reason := runRequiredLibraryPropertiesFieldCheck ()
620
+ if ! shouldRun {
621
+ return checkresult .NotRun , reason
617
622
}
618
623
619
624
if schema .RequiredPropertyMissing ("sentence" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
@@ -646,8 +651,9 @@ func LibraryPropertiesSentenceFieldSpellCheck() (result checkresult.Type, output
646
651
647
652
// LibraryPropertiesParagraphFieldMissing checks for missing library.properties "paragraph" field.
648
653
func LibraryPropertiesParagraphFieldMissing () (result checkresult.Type , output string ) {
649
- if checkdata .LibraryPropertiesLoadError () != nil {
650
- return checkresult .NotRun , "Couldn't load library.properties"
654
+ shouldRun , reason := runRequiredLibraryPropertiesFieldCheck ()
655
+ if ! shouldRun {
656
+ return checkresult .NotRun , reason
651
657
}
652
658
653
659
if schema .RequiredPropertyMissing ("paragraph" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
@@ -682,8 +688,9 @@ func LibraryPropertiesParagraphFieldRepeatsSentence() (result checkresult.Type,
682
688
683
689
// LibraryPropertiesCategoryFieldMissing checks for missing library.properties "category" field.
684
690
func LibraryPropertiesCategoryFieldMissing () (result checkresult.Type , output string ) {
685
- if checkdata .LibraryPropertiesLoadError () != nil {
686
- return checkresult .NotRun , "Couldn't load library.properties"
691
+ shouldRun , reason := runRequiredLibraryPropertiesFieldCheck ()
692
+ if ! shouldRun {
693
+ return checkresult .NotRun , reason
687
694
}
688
695
689
696
if schema .RequiredPropertyMissing ("category" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
@@ -730,8 +737,9 @@ func LibraryPropertiesCategoryFieldUncategorized() (result checkresult.Type, out
730
737
731
738
// LibraryPropertiesUrlFieldMissing checks for missing library.properties "url" field.
732
739
func LibraryPropertiesUrlFieldMissing () (result checkresult.Type , output string ) {
733
- if checkdata .LibraryPropertiesLoadError () != nil {
734
- return checkresult .NotRun , "Couldn't load library.properties"
740
+ shouldRun , reason := runRequiredLibraryPropertiesFieldCheck ()
741
+ if ! shouldRun {
742
+ return checkresult .NotRun , reason
735
743
}
736
744
737
745
if schema .RequiredPropertyMissing ("url" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
@@ -784,8 +792,9 @@ func LibraryPropertiesUrlFieldDeadLink() (result checkresult.Type, output string
784
792
785
793
// LibraryPropertiesArchitecturesFieldMissing checks for missing library.properties "architectures" field.
786
794
func LibraryPropertiesArchitecturesFieldMissing () (result checkresult.Type , output string ) {
787
- if checkdata .LibraryPropertiesLoadError () != nil {
788
- return checkresult .NotRun , "Couldn't load library.properties"
795
+ shouldRun , reason := runRequiredLibraryPropertiesFieldCheck ()
796
+ if ! shouldRun {
797
+ return checkresult .NotRun , reason
789
798
}
790
799
791
800
if schema .RequiredPropertyMissing ("architectures" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
@@ -1318,3 +1327,15 @@ func nameInLibraryManagerIndex(name string) bool {
1318
1327
1319
1328
return false
1320
1329
}
1330
+
1331
+ func runRequiredLibraryPropertiesFieldCheck () (bool , string ) {
1332
+ if checkdata .LibraryPropertiesLoadError () != nil {
1333
+ return false , "Couldn't load library.properties"
1334
+ }
1335
+
1336
+ if checkdata .LoadedLibrary ().IsLegacy {
1337
+ return false , "Library has legacy format"
1338
+ }
1339
+
1340
+ return true , ""
1341
+ }
0 commit comments