@@ -43,7 +43,7 @@ import (
43
43
// LibraryPropertiesFormat checks for invalid library.properties format.
44
44
func LibraryPropertiesFormat () (result checkresult.Type , output string ) {
45
45
if checkdata .LoadedLibrary () != nil && checkdata .LoadedLibrary ().IsLegacy {
46
- return checkresult .NotRun , "Library has no library.properties"
46
+ return checkresult .Skip , "Library has no library.properties"
47
47
}
48
48
49
49
if checkdata .LibraryPropertiesLoadError () != nil {
@@ -110,9 +110,12 @@ 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
- shouldRun , reason := runRequiredLibraryPropertiesFieldCheck ()
114
- if ! shouldRun {
115
- return checkresult .NotRun , reason
113
+ if checkdata .LibraryPropertiesLoadError () != nil {
114
+ return checkresult .NotRun , "Couldn't load library.properties"
115
+ }
116
+
117
+ if checkdata .LoadedLibrary ().IsLegacy {
118
+ return checkresult .Skip , "Library has legacy format"
116
119
}
117
120
118
121
if schema .RequiredPropertyMissing ("name" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
@@ -340,9 +343,12 @@ func LibraryPropertiesNameFieldHeaderMismatch() (result checkresult.Type, output
340
343
341
344
// LibraryPropertiesVersionFieldMissing checks for missing library.properties "version" field.
342
345
func LibraryPropertiesVersionFieldMissing () (result checkresult.Type , output string ) {
343
- shouldRun , reason := runRequiredLibraryPropertiesFieldCheck ()
344
- if ! shouldRun {
345
- return checkresult .NotRun , reason
346
+ if checkdata .LibraryPropertiesLoadError () != nil {
347
+ return checkresult .NotRun , "Couldn't load library.properties"
348
+ }
349
+
350
+ if checkdata .LoadedLibrary ().IsLegacy {
351
+ return checkresult .Skip , "Library has legacy format"
346
352
}
347
353
348
354
if schema .RequiredPropertyMissing ("version" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
@@ -390,7 +396,7 @@ func LibraryPropertiesVersionFieldNonSemver() (result checkresult.Type, output s
390
396
// LibraryPropertiesVersionFieldBehindTag checks whether a release tag was made without first bumping the library.properties version value.
391
397
func LibraryPropertiesVersionFieldBehindTag () (result checkresult.Type , output string ) {
392
398
if checkdata .ProjectType () != checkdata .SuperProjectType () {
393
- return checkresult .NotRun , "Not relevant for subprojects"
399
+ return checkresult .Skip , "Not relevant for subprojects"
394
400
}
395
401
396
402
if checkdata .LibraryPropertiesLoadError () != nil {
@@ -410,7 +416,7 @@ func LibraryPropertiesVersionFieldBehindTag() (result checkresult.Type, output s
410
416
411
417
repository , err := git .PlainOpen (checkdata .ProjectPath ().String ())
412
418
if err != nil {
413
- return checkresult .NotRun , "Project path is not a repository"
419
+ return checkresult .Skip , "Project path is not a repository"
414
420
}
415
421
416
422
headRef , err := repository .Head ()
@@ -482,9 +488,12 @@ func LibraryPropertiesVersionFieldBehindTag() (result checkresult.Type, output s
482
488
483
489
// LibraryPropertiesAuthorFieldMissing checks for missing library.properties "author" field.
484
490
func LibraryPropertiesAuthorFieldMissing () (result checkresult.Type , output string ) {
485
- shouldRun , reason := runRequiredLibraryPropertiesFieldCheck ()
486
- if ! shouldRun {
487
- return checkresult .NotRun , reason
491
+ if checkdata .LibraryPropertiesLoadError () != nil {
492
+ return checkresult .NotRun , "Couldn't load library.properties"
493
+ }
494
+
495
+ if checkdata .LoadedLibrary ().IsLegacy {
496
+ return checkresult .Skip , "Library has legacy format"
488
497
}
489
498
490
499
if schema .RequiredPropertyMissing ("author" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
@@ -512,9 +521,12 @@ func LibraryPropertiesAuthorFieldLTMinLength() (result checkresult.Type, output
512
521
513
522
// LibraryPropertiesMaintainerFieldMissing checks for missing library.properties "maintainer" field.
514
523
func LibraryPropertiesMaintainerFieldMissing () (result checkresult.Type , output string ) {
515
- shouldRun , reason := runRequiredLibraryPropertiesFieldCheck ()
516
- if ! shouldRun {
517
- return checkresult .NotRun , reason
524
+ if checkdata .LibraryPropertiesLoadError () != nil {
525
+ return checkresult .NotRun , "Couldn't load library.properties"
526
+ }
527
+
528
+ if checkdata .LoadedLibrary ().IsLegacy {
529
+ return checkresult .Skip , "Library has legacy format"
518
530
}
519
531
520
532
if schema .RequiredPropertyMissing ("maintainer" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
@@ -565,7 +577,7 @@ func LibraryPropertiesEmailFieldAsMaintainerAlias() (result checkresult.Type, ou
565
577
}
566
578
567
579
if ! checkdata .LibraryProperties ().ContainsKey ("email" ) {
568
- return checkresult .NotRun , "Field not present"
580
+ return checkresult .Skip , "Field not present"
569
581
}
570
582
571
583
if ! checkdata .LibraryProperties ().ContainsKey ("maintainer" ) {
@@ -582,7 +594,7 @@ func LibraryPropertiesEmailFieldLTMinLength() (result checkresult.Type, output s
582
594
}
583
595
584
596
if checkdata .LibraryProperties ().ContainsKey ("maintainer" ) || ! checkdata .LibraryProperties ().ContainsKey ("email" ) {
585
- return checkresult .NotRun , "Field not present"
597
+ return checkresult .Skip , "Field not present"
586
598
}
587
599
588
600
if schema .PropertyLessThanMinLength ("email" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
@@ -604,7 +616,7 @@ func LibraryPropertiesEmailFieldStartsWithArduino() (result checkresult.Type, ou
604
616
605
617
email , ok := checkdata .LibraryProperties ().GetOk ("email" )
606
618
if ! ok {
607
- return checkresult .NotRun , "Field not present"
619
+ return checkresult .Skip , "Field not present"
608
620
}
609
621
610
622
if schema .ValidationErrorMatch ("^#/email$" , "/patternObjects/notStartsWithArduino" , "" , "" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
@@ -616,9 +628,12 @@ func LibraryPropertiesEmailFieldStartsWithArduino() (result checkresult.Type, ou
616
628
617
629
// LibraryPropertiesSentenceFieldMissing checks for missing library.properties "sentence" field.
618
630
func LibraryPropertiesSentenceFieldMissing () (result checkresult.Type , output string ) {
619
- shouldRun , reason := runRequiredLibraryPropertiesFieldCheck ()
620
- if ! shouldRun {
621
- return checkresult .NotRun , reason
631
+ if checkdata .LibraryPropertiesLoadError () != nil {
632
+ return checkresult .NotRun , "Couldn't load library.properties"
633
+ }
634
+
635
+ if checkdata .LoadedLibrary ().IsLegacy {
636
+ return checkresult .Skip , "Library has legacy format"
622
637
}
623
638
624
639
if schema .RequiredPropertyMissing ("sentence" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
@@ -651,9 +666,12 @@ func LibraryPropertiesSentenceFieldSpellCheck() (result checkresult.Type, output
651
666
652
667
// LibraryPropertiesParagraphFieldMissing checks for missing library.properties "paragraph" field.
653
668
func LibraryPropertiesParagraphFieldMissing () (result checkresult.Type , output string ) {
654
- shouldRun , reason := runRequiredLibraryPropertiesFieldCheck ()
655
- if ! shouldRun {
656
- return checkresult .NotRun , reason
669
+ if checkdata .LibraryPropertiesLoadError () != nil {
670
+ return checkresult .NotRun , "Couldn't load library.properties"
671
+ }
672
+
673
+ if checkdata .LoadedLibrary ().IsLegacy {
674
+ return checkresult .Skip , "Library has legacy format"
657
675
}
658
676
659
677
if schema .RequiredPropertyMissing ("paragraph" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
@@ -688,9 +706,12 @@ func LibraryPropertiesParagraphFieldRepeatsSentence() (result checkresult.Type,
688
706
689
707
// LibraryPropertiesCategoryFieldMissing checks for missing library.properties "category" field.
690
708
func LibraryPropertiesCategoryFieldMissing () (result checkresult.Type , output string ) {
691
- shouldRun , reason := runRequiredLibraryPropertiesFieldCheck ()
692
- if ! shouldRun {
693
- return checkresult .NotRun , reason
709
+ if checkdata .LibraryPropertiesLoadError () != nil {
710
+ return checkresult .NotRun , "Couldn't load library.properties"
711
+ }
712
+
713
+ if checkdata .LoadedLibrary ().IsLegacy {
714
+ return checkresult .Skip , "Library has legacy format"
694
715
}
695
716
696
717
if schema .RequiredPropertyMissing ("category" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
@@ -707,7 +728,7 @@ func LibraryPropertiesCategoryFieldInvalid() (result checkresult.Type, output st
707
728
708
729
category , ok := checkdata .LibraryProperties ().GetOk ("category" )
709
730
if ! ok {
710
- return checkresult .NotRun , "Field not present"
731
+ return checkresult .Skip , "Field not present"
711
732
}
712
733
713
734
if schema .PropertyEnumMismatch ("category" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
@@ -725,7 +746,7 @@ func LibraryPropertiesCategoryFieldUncategorized() (result checkresult.Type, out
725
746
726
747
category , ok := checkdata .LibraryProperties ().GetOk ("category" )
727
748
if ! ok {
728
- return checkresult .NotRun , "Field not present"
749
+ return checkresult .Skip , "Field not present"
729
750
}
730
751
731
752
if category == "Uncategorized" {
@@ -737,9 +758,12 @@ func LibraryPropertiesCategoryFieldUncategorized() (result checkresult.Type, out
737
758
738
759
// LibraryPropertiesUrlFieldMissing checks for missing library.properties "url" field.
739
760
func LibraryPropertiesUrlFieldMissing () (result checkresult.Type , output string ) {
740
- shouldRun , reason := runRequiredLibraryPropertiesFieldCheck ()
741
- if ! shouldRun {
742
- return checkresult .NotRun , reason
761
+ if checkdata .LibraryPropertiesLoadError () != nil {
762
+ return checkresult .NotRun , "Couldn't load library.properties"
763
+ }
764
+
765
+ if checkdata .LoadedLibrary ().IsLegacy {
766
+ return checkresult .Skip , "Library has legacy format"
743
767
}
744
768
745
769
if schema .RequiredPropertyMissing ("url" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
@@ -792,9 +816,12 @@ func LibraryPropertiesUrlFieldDeadLink() (result checkresult.Type, output string
792
816
793
817
// LibraryPropertiesArchitecturesFieldMissing checks for missing library.properties "architectures" field.
794
818
func LibraryPropertiesArchitecturesFieldMissing () (result checkresult.Type , output string ) {
795
- shouldRun , reason := runRequiredLibraryPropertiesFieldCheck ()
796
- if ! shouldRun {
797
- return checkresult .NotRun , reason
819
+ if checkdata .LibraryPropertiesLoadError () != nil {
820
+ return checkresult .NotRun , "Couldn't load library.properties"
821
+ }
822
+
823
+ if checkdata .LoadedLibrary ().IsLegacy {
824
+ return checkresult .Skip , "Library has legacy format"
798
825
}
799
826
800
827
if schema .RequiredPropertyMissing ("architectures" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
@@ -810,7 +837,7 @@ func LibraryPropertiesArchitecturesFieldLTMinLength() (result checkresult.Type,
810
837
}
811
838
812
839
if ! checkdata .LibraryProperties ().ContainsKey ("architectures" ) {
813
- return checkresult .NotRun , "Field not present"
840
+ return checkresult .Skip , "Field not present"
814
841
}
815
842
816
843
if schema .PropertyLessThanMinLength ("architectures" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
@@ -828,7 +855,7 @@ func LibraryPropertiesDependsFieldDisallowedCharacters() (result checkresult.Typ
828
855
829
856
depends , ok := checkdata .LibraryProperties ().GetOk ("depends" )
830
857
if ! ok {
831
- return checkresult .NotRun , "Field not present"
858
+ return checkresult .Skip , "Field not present"
832
859
}
833
860
834
861
if schema .PropertyPatternMismatch ("depends" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
@@ -846,7 +873,7 @@ func LibraryPropertiesDependsFieldNotInIndex() (result checkresult.Type, output
846
873
847
874
depends , hasDepends := checkdata .LibraryProperties ().GetOk ("depends" )
848
875
if ! hasDepends {
849
- return checkresult .NotRun , "Field not present"
876
+ return checkresult .Skip , "Field not present"
850
877
}
851
878
852
879
dependencies := strings .Split (depends , "," )
@@ -878,7 +905,7 @@ func LibraryPropertiesDotALinkageFieldInvalid() (result checkresult.Type, output
878
905
879
906
dotALinkage , ok := checkdata .LibraryProperties ().GetOk ("dot_a_linkage" )
880
907
if ! ok {
881
- return checkresult .NotRun , "Field not present"
908
+ return checkresult .Skip , "Field not present"
882
909
}
883
910
884
911
if schema .PropertyEnumMismatch ("dot_a_linkage" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
@@ -895,7 +922,7 @@ func LibraryPropertiesDotALinkageFieldTrueWithFlatLayout() (result checkresult.T
895
922
}
896
923
897
924
if ! checkdata .LibraryProperties ().ContainsKey ("dot_a_linkage" ) {
898
- return checkresult .NotRun , "Field not present"
925
+ return checkresult .Skip , "Field not present"
899
926
}
900
927
901
928
if checkdata .LoadedLibrary ().DotALinkage && checkdata .LoadedLibrary ().Layout == libraries .FlatLayout {
@@ -912,7 +939,7 @@ func LibraryPropertiesIncludesFieldLTMinLength() (result checkresult.Type, outpu
912
939
}
913
940
914
941
if ! checkdata .LibraryProperties ().ContainsKey ("includes" ) {
915
- return checkresult .NotRun , "Field not present"
942
+ return checkresult .Skip , "Field not present"
916
943
}
917
944
918
945
if schema .PropertyLessThanMinLength ("includes" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
@@ -930,7 +957,7 @@ func LibraryPropertiesIncludesFieldItemNotFound() (result checkresult.Type, outp
930
957
931
958
includes , ok := checkdata .LibraryProperties ().GetOk ("includes" )
932
959
if ! ok {
933
- return checkresult .NotRun , "Field not present"
960
+ return checkresult .Skip , "Field not present"
934
961
}
935
962
936
963
includesList := strings .Split (includes , "," )
@@ -972,7 +999,7 @@ func LibraryPropertiesPrecompiledFieldInvalid() (result checkresult.Type, output
972
999
973
1000
precompiled , ok := checkdata .LibraryProperties ().GetOk ("precompiled" )
974
1001
if ! ok {
975
- return checkresult .NotRun , "Field not present"
1002
+ return checkresult .Skip , "Field not present"
976
1003
}
977
1004
978
1005
if schema .PropertyEnumMismatch ("precompiled" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
@@ -990,7 +1017,7 @@ func LibraryPropertiesPrecompiledFieldEnabledWithFlatLayout() (result checkresul
990
1017
991
1018
precompiled , ok := checkdata .LibraryProperties ().GetOk ("precompiled" )
992
1019
if ! ok {
993
- return checkresult .NotRun , "Field not present"
1020
+ return checkresult .Skip , "Field not present"
994
1021
}
995
1022
996
1023
if checkdata .LoadedLibrary ().Precompiled && checkdata .LoadedLibrary ().Layout == libraries .FlatLayout {
@@ -1006,6 +1033,10 @@ func LibraryPropertiesLdflagsFieldLTMinLength() (result checkresult.Type, output
1006
1033
return checkresult .NotRun , "Library not loaded"
1007
1034
}
1008
1035
1036
+ if ! checkdata .LibraryProperties ().ContainsKey ("ldflags" ) {
1037
+ return checkresult .Skip , "Field not present"
1038
+ }
1039
+
1009
1040
if schema .PropertyLessThanMinLength ("ldflags" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
1010
1041
return checkresult .Fail , ""
1011
1042
}
@@ -1175,7 +1206,7 @@ func LibraryFolderNameGTMaxLength() (result checkresult.Type, output string) {
1175
1206
func IncorrectLibrarySrcFolderNameCase () (result checkresult.Type , output string ) {
1176
1207
if library .ContainsMetadataFile (checkdata .ProjectPath ()) && library .ContainsHeaderFile (checkdata .ProjectPath ()) {
1177
1208
// Flat layout, so no special treatment of src subfolder.
1178
- return checkresult .NotRun , "Not applicable due to layout type"
1209
+ return checkresult .Skip , "Not applicable due to layout type"
1179
1210
}
1180
1211
1181
1212
// The library is intended to have the recursive layout.
@@ -1270,7 +1301,7 @@ func RecursiveLibraryWithUtilityFolder() (result checkresult.Type, output string
1270
1301
}
1271
1302
1272
1303
if checkdata .LoadedLibrary ().Layout == libraries .FlatLayout {
1273
- return checkresult .NotRun , "Not applicable due to layout type"
1304
+ return checkresult .Skip , "Not applicable due to layout type"
1274
1305
}
1275
1306
1276
1307
if checkdata .ProjectPath ().Join ("utility" ).Exist () {
@@ -1288,7 +1319,7 @@ func spellCheckLibraryPropertiesFieldValue(fieldName string) (result checkresult
1288
1319
1289
1320
fieldValue , ok := checkdata .LibraryProperties ().GetOk (fieldName )
1290
1321
if ! ok {
1291
- return checkresult .NotRun , "Field not present"
1322
+ return checkresult .Skip , "Field not present"
1292
1323
}
1293
1324
1294
1325
replaced , diff := checkdata .MisspelledWordsReplacer ().Replace (fieldValue )
@@ -1327,15 +1358,3 @@ func nameInLibraryManagerIndex(name string) bool {
1327
1358
1328
1359
return false
1329
1360
}
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