@@ -691,6 +691,14 @@ func PlatformTxtCompilerWarningFlagsNoneMissing() (result ruleresult.Type, outpu
691
691
return ruleresult .NotRun , "Couldn't load platform.txt"
692
692
}
693
693
694
+ if projectdata .BoardsTxtLoadError () != nil {
695
+ return ruleresult .NotRun , "Couldn't load boards.txt"
696
+ }
697
+
698
+ if platformReferencesCore () {
699
+ return ruleresult .Skip , "Core reference used"
700
+ }
701
+
694
702
if schema .RequiredPropertyMissing ("compiler\\ .warning_flags\\ .none" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Specification ]) {
695
703
return ruleresult .Fail , ""
696
704
}
@@ -708,6 +716,14 @@ func PlatformTxtCompilerWarningFlagsDefaultMissing() (result ruleresult.Type, ou
708
716
return ruleresult .NotRun , "Couldn't load platform.txt"
709
717
}
710
718
719
+ if projectdata .BoardsTxtLoadError () != nil {
720
+ return ruleresult .NotRun , "Couldn't load boards.txt"
721
+ }
722
+
723
+ if platformReferencesCore () {
724
+ return ruleresult .Skip , "Core reference used"
725
+ }
726
+
711
727
if schema .RequiredPropertyMissing ("compiler\\ .warning_flags\\ .default" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Specification ]) {
712
728
return ruleresult .Fail , ""
713
729
}
@@ -725,6 +741,14 @@ func PlatformTxtCompilerWarningFlagsMoreMissing() (result ruleresult.Type, outpu
725
741
return ruleresult .NotRun , "Couldn't load platform.txt"
726
742
}
727
743
744
+ if projectdata .BoardsTxtLoadError () != nil {
745
+ return ruleresult .NotRun , "Couldn't load boards.txt"
746
+ }
747
+
748
+ if platformReferencesCore () {
749
+ return ruleresult .Skip , "Core reference used"
750
+ }
751
+
728
752
if schema .RequiredPropertyMissing ("compiler\\ .warning_flags\\ .more" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Specification ]) {
729
753
return ruleresult .Fail , ""
730
754
}
@@ -742,6 +766,14 @@ func PlatformTxtCompilerWarningFlagsAllMissing() (result ruleresult.Type, output
742
766
return ruleresult .NotRun , "Couldn't load platform.txt"
743
767
}
744
768
769
+ if projectdata .BoardsTxtLoadError () != nil {
770
+ return ruleresult .NotRun , "Couldn't load boards.txt"
771
+ }
772
+
773
+ if platformReferencesCore () {
774
+ return ruleresult .Skip , "Core reference used"
775
+ }
776
+
745
777
if schema .RequiredPropertyMissing ("compiler\\ .warning_flags\\ .all" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Specification ]) {
746
778
return ruleresult .Fail , ""
747
779
}
@@ -759,6 +791,14 @@ func PlatformTxtCompilerOptimizationFlagsDebugMissing() (result ruleresult.Type,
759
791
return ruleresult .NotRun , "Couldn't load platform.txt"
760
792
}
761
793
794
+ if projectdata .BoardsTxtLoadError () != nil {
795
+ return ruleresult .NotRun , "Couldn't load boards.txt"
796
+ }
797
+
798
+ if platformReferencesCore () {
799
+ return ruleresult .Skip , "Core reference used"
800
+ }
801
+
762
802
if ! projectdata .PlatformTxt ().ContainsKey ("compiler.optimization_flags.release" ) {
763
803
return ruleresult .Skip , "Dependent property not present"
764
804
}
@@ -780,6 +820,14 @@ func PlatformTxtCompilerOptimizationFlagsReleaseMissing() (result ruleresult.Typ
780
820
return ruleresult .NotRun , "Couldn't load platform.txt"
781
821
}
782
822
823
+ if projectdata .BoardsTxtLoadError () != nil {
824
+ return ruleresult .NotRun , "Couldn't load boards.txt"
825
+ }
826
+
827
+ if platformReferencesCore () {
828
+ return ruleresult .Skip , "Core reference used"
829
+ }
830
+
783
831
if ! projectdata .PlatformTxt ().ContainsKey ("compiler.optimization_flags.debug" ) {
784
832
return ruleresult .Skip , "Dependent property not present"
785
833
}
@@ -801,6 +849,14 @@ func PlatformTxtCompilerCExtraFlagsMissing() (result ruleresult.Type, output str
801
849
return ruleresult .NotRun , "Couldn't load platform.txt"
802
850
}
803
851
852
+ if projectdata .BoardsTxtLoadError () != nil {
853
+ return ruleresult .NotRun , "Couldn't load boards.txt"
854
+ }
855
+
856
+ if platformReferencesCore () {
857
+ return ruleresult .Skip , "Core reference used"
858
+ }
859
+
804
860
if schema .RequiredPropertyMissing ("compiler\\ .c\\ .extra_flags" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Strict ]) {
805
861
return ruleresult .Fail , ""
806
862
}
@@ -839,6 +895,14 @@ func PlatformTxtCompilerCppExtraFlagsMissing() (result ruleresult.Type, output s
839
895
return ruleresult .NotRun , "Couldn't load platform.txt"
840
896
}
841
897
898
+ if projectdata .BoardsTxtLoadError () != nil {
899
+ return ruleresult .NotRun , "Couldn't load boards.txt"
900
+ }
901
+
902
+ if platformReferencesCore () {
903
+ return ruleresult .Skip , "Core reference used"
904
+ }
905
+
842
906
if schema .RequiredPropertyMissing ("compiler\\ .cpp\\ .extra_flags" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Strict ]) {
843
907
return ruleresult .Fail , ""
844
908
}
@@ -877,6 +941,14 @@ func PlatformTxtCompilerSExtraFlagsMissing() (result ruleresult.Type, output str
877
941
return ruleresult .NotRun , "Couldn't load platform.txt"
878
942
}
879
943
944
+ if projectdata .BoardsTxtLoadError () != nil {
945
+ return ruleresult .NotRun , "Couldn't load boards.txt"
946
+ }
947
+
948
+ if platformReferencesCore () {
949
+ return ruleresult .Skip , "Core reference used"
950
+ }
951
+
880
952
if schema .RequiredPropertyMissing ("compiler\\ .S\\ .extra_flags" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Strict ]) {
881
953
return ruleresult .Fail , ""
882
954
}
@@ -915,6 +987,14 @@ func PlatformTxtCompilerArExtraFlagsMissing() (result ruleresult.Type, output st
915
987
return ruleresult .NotRun , "Couldn't load platform.txt"
916
988
}
917
989
990
+ if projectdata .BoardsTxtLoadError () != nil {
991
+ return ruleresult .NotRun , "Couldn't load boards.txt"
992
+ }
993
+
994
+ if platformReferencesCore () {
995
+ return ruleresult .Skip , "Core reference used"
996
+ }
997
+
918
998
if schema .RequiredPropertyMissing ("compiler\\ .ar\\ .extra_flags" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Strict ]) {
919
999
return ruleresult .Fail , ""
920
1000
}
@@ -953,6 +1033,14 @@ func PlatformTxtCompilerCElfExtraFlagsMissing() (result ruleresult.Type, output
953
1033
return ruleresult .NotRun , "Couldn't load platform.txt"
954
1034
}
955
1035
1036
+ if projectdata .BoardsTxtLoadError () != nil {
1037
+ return ruleresult .NotRun , "Couldn't load boards.txt"
1038
+ }
1039
+
1040
+ if platformReferencesCore () {
1041
+ return ruleresult .Skip , "Core reference used"
1042
+ }
1043
+
956
1044
if schema .RequiredPropertyMissing ("compiler\\ .c\\ .elf\\ .extra_flags" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Strict ]) {
957
1045
return ruleresult .Fail , ""
958
1046
}
@@ -1033,6 +1121,14 @@ func PlatformTxtRecipeCOPatternMissing() (result ruleresult.Type, output string)
1033
1121
return ruleresult .NotRun , "Couldn't load platform.txt"
1034
1122
}
1035
1123
1124
+ if projectdata .BoardsTxtLoadError () != nil {
1125
+ return ruleresult .NotRun , "Couldn't load boards.txt"
1126
+ }
1127
+
1128
+ if platformReferencesCore () {
1129
+ return ruleresult .Skip , "Core reference used"
1130
+ }
1131
+
1036
1132
if schema .RequiredPropertyMissing ("recipe\\ .c\\ .o\\ .pattern" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Specification ]) {
1037
1133
return ruleresult .Fail , ""
1038
1134
}
@@ -1092,6 +1188,14 @@ func PlatformTxtRecipeCppOPatternMissing() (result ruleresult.Type, output strin
1092
1188
return ruleresult .NotRun , "Couldn't load platform.txt"
1093
1189
}
1094
1190
1191
+ if projectdata .BoardsTxtLoadError () != nil {
1192
+ return ruleresult .NotRun , "Couldn't load boards.txt"
1193
+ }
1194
+
1195
+ if platformReferencesCore () {
1196
+ return ruleresult .Skip , "Core reference used"
1197
+ }
1198
+
1095
1199
if schema .RequiredPropertyMissing ("recipe\\ .cpp\\ .o\\ .pattern" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Specification ]) {
1096
1200
return ruleresult .Fail , ""
1097
1201
}
@@ -1151,6 +1255,14 @@ func PlatformTxtRecipeSOPatternMissing() (result ruleresult.Type, output string)
1151
1255
return ruleresult .NotRun , "Couldn't load platform.txt"
1152
1256
}
1153
1257
1258
+ if projectdata .BoardsTxtLoadError () != nil {
1259
+ return ruleresult .NotRun , "Couldn't load boards.txt"
1260
+ }
1261
+
1262
+ if platformReferencesCore () {
1263
+ return ruleresult .Skip , "Core reference used"
1264
+ }
1265
+
1154
1266
if schema .RequiredPropertyMissing ("recipe\\ .S\\ .o\\ .pattern" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Specification ]) {
1155
1267
return ruleresult .Fail , ""
1156
1268
}
@@ -1210,6 +1322,14 @@ func PlatformTxtRecipeArPatternMissing() (result ruleresult.Type, output string)
1210
1322
return ruleresult .NotRun , "Couldn't load platform.txt"
1211
1323
}
1212
1324
1325
+ if projectdata .BoardsTxtLoadError () != nil {
1326
+ return ruleresult .NotRun , "Couldn't load boards.txt"
1327
+ }
1328
+
1329
+ if platformReferencesCore () {
1330
+ return ruleresult .Skip , "Core reference used"
1331
+ }
1332
+
1213
1333
if schema .RequiredPropertyMissing ("recipe\\ .ar\\ .pattern" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Specification ]) {
1214
1334
return ruleresult .Fail , ""
1215
1335
}
@@ -1269,6 +1389,14 @@ func PlatformTxtRecipeCCombinePatternMissing() (result ruleresult.Type, output s
1269
1389
return ruleresult .NotRun , "Couldn't load platform.txt"
1270
1390
}
1271
1391
1392
+ if projectdata .BoardsTxtLoadError () != nil {
1393
+ return ruleresult .NotRun , "Couldn't load boards.txt"
1394
+ }
1395
+
1396
+ if platformReferencesCore () {
1397
+ return ruleresult .Skip , "Core reference used"
1398
+ }
1399
+
1272
1400
if schema .RequiredPropertyMissing ("recipe\\ .c\\ .combine\\ .pattern" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Specification ]) {
1273
1401
return ruleresult .Fail , ""
1274
1402
}
@@ -1328,6 +1456,14 @@ func PlatformTxtRecipeOutputTmpFileMissing() (result ruleresult.Type, output str
1328
1456
return ruleresult .NotRun , "Couldn't load platform.txt"
1329
1457
}
1330
1458
1459
+ if projectdata .BoardsTxtLoadError () != nil {
1460
+ return ruleresult .NotRun , "Couldn't load boards.txt"
1461
+ }
1462
+
1463
+ if platformReferencesCore () {
1464
+ return ruleresult .Skip , "Core reference used"
1465
+ }
1466
+
1331
1467
if schema .RequiredPropertyMissing ("recipe\\ .output\\ .tmp_file" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Specification ]) {
1332
1468
return ruleresult .Fail , ""
1333
1469
}
@@ -1366,6 +1502,14 @@ func PlatformTxtRecipeOutputSaveFileMissing() (result ruleresult.Type, output st
1366
1502
return ruleresult .NotRun , "Couldn't load platform.txt"
1367
1503
}
1368
1504
1505
+ if projectdata .BoardsTxtLoadError () != nil {
1506
+ return ruleresult .NotRun , "Couldn't load boards.txt"
1507
+ }
1508
+
1509
+ if platformReferencesCore () {
1510
+ return ruleresult .Skip , "Core reference used"
1511
+ }
1512
+
1369
1513
if schema .RequiredPropertyMissing ("recipe\\ .output\\ .save_file" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Specification ]) {
1370
1514
return ruleresult .Fail , ""
1371
1515
}
@@ -1404,6 +1548,14 @@ func PlatformTxtRecipeSizePatternMissing() (result ruleresult.Type, output strin
1404
1548
return ruleresult .NotRun , "Couldn't load platform.txt"
1405
1549
}
1406
1550
1551
+ if projectdata .BoardsTxtLoadError () != nil {
1552
+ return ruleresult .NotRun , "Couldn't load boards.txt"
1553
+ }
1554
+
1555
+ if platformReferencesCore () {
1556
+ return ruleresult .Skip , "Core reference used"
1557
+ }
1558
+
1407
1559
if schema .RequiredPropertyMissing ("recipe\\ .size\\ .pattern" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Strict ]) {
1408
1560
return ruleresult .Fail , ""
1409
1561
}
@@ -1442,6 +1594,14 @@ func PlatformTxtRecipeSizeRegexMissing() (result ruleresult.Type, output string)
1442
1594
return ruleresult .NotRun , "Couldn't load platform.txt"
1443
1595
}
1444
1596
1597
+ if projectdata .BoardsTxtLoadError () != nil {
1598
+ return ruleresult .NotRun , "Couldn't load boards.txt"
1599
+ }
1600
+
1601
+ if platformReferencesCore () {
1602
+ return ruleresult .Skip , "Core reference used"
1603
+ }
1604
+
1445
1605
if schema .RequiredPropertyMissing ("recipe\\ .size\\ .regex" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Strict ]) {
1446
1606
return ruleresult .Fail , ""
1447
1607
}
@@ -1459,6 +1619,14 @@ func PlatformTxtRecipeSizeRegexDataMissing() (result ruleresult.Type, output str
1459
1619
return ruleresult .NotRun , "Couldn't load platform.txt"
1460
1620
}
1461
1621
1622
+ if projectdata .BoardsTxtLoadError () != nil {
1623
+ return ruleresult .NotRun , "Couldn't load boards.txt"
1624
+ }
1625
+
1626
+ if platformReferencesCore () {
1627
+ return ruleresult .Skip , "Core reference used"
1628
+ }
1629
+
1462
1630
if schema .RequiredPropertyMissing ("recipe\\ .size\\ .regex\\ .data" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Strict ]) {
1463
1631
return ruleresult .Fail , ""
1464
1632
}
@@ -1892,3 +2060,26 @@ func iDValuePatternMismatch(iDs []string, propertyNameQuery string, validationRe
1892
2060
1893
2061
return nonCompliantIDs
1894
2062
}
2063
+
2064
+ // platformReferencesCore checks whether all boards of the platform use core references.
2065
+ // See: https://arduino.github.io/arduino-cli/dev/platform-specification/#core-reference
2066
+ func platformReferencesCore () bool {
2067
+ referencesCore := false // Default return value.
2068
+ for _ , boardID := range projectdata .BoardsTxt ().FirstLevelKeys () {
2069
+ if boardID != "menu" {
2070
+ // It is a board ID.
2071
+ boardProperties := projectdata .BoardsTxt ().SubTree (boardID )
2072
+ for _ , key := range boardProperties .Keys () {
2073
+ if key == "build.core" || strings .HasSuffix (key , ".build.core" ) {
2074
+ if ! strings .Contains (boardProperties .ExpandPropsInString (boardProperties .Get (key )), ":" ) {
2075
+ // This board does not use a core reference.
2076
+ return false
2077
+ }
2078
+ referencesCore = true
2079
+ }
2080
+ }
2081
+ }
2082
+ }
2083
+
2084
+ return referencesCore
2085
+ }
0 commit comments