@@ -691,6 +691,14 @@ func PlatformTxtCompilerWarningFlagsNoneMissing() (result ruleresult.Type, outpu
691691 return ruleresult .NotRun , "Couldn't load platform.txt"
692692 }
693693
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+
694702 if schema .RequiredPropertyMissing ("compiler\\ .warning_flags\\ .none" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Specification ]) {
695703 return ruleresult .Fail , ""
696704 }
@@ -708,6 +716,14 @@ func PlatformTxtCompilerWarningFlagsDefaultMissing() (result ruleresult.Type, ou
708716 return ruleresult .NotRun , "Couldn't load platform.txt"
709717 }
710718
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+
711727 if schema .RequiredPropertyMissing ("compiler\\ .warning_flags\\ .default" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Specification ]) {
712728 return ruleresult .Fail , ""
713729 }
@@ -725,6 +741,14 @@ func PlatformTxtCompilerWarningFlagsMoreMissing() (result ruleresult.Type, outpu
725741 return ruleresult .NotRun , "Couldn't load platform.txt"
726742 }
727743
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+
728752 if schema .RequiredPropertyMissing ("compiler\\ .warning_flags\\ .more" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Specification ]) {
729753 return ruleresult .Fail , ""
730754 }
@@ -742,6 +766,14 @@ func PlatformTxtCompilerWarningFlagsAllMissing() (result ruleresult.Type, output
742766 return ruleresult .NotRun , "Couldn't load platform.txt"
743767 }
744768
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+
745777 if schema .RequiredPropertyMissing ("compiler\\ .warning_flags\\ .all" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Specification ]) {
746778 return ruleresult .Fail , ""
747779 }
@@ -759,6 +791,14 @@ func PlatformTxtCompilerOptimizationFlagsDebugMissing() (result ruleresult.Type,
759791 return ruleresult .NotRun , "Couldn't load platform.txt"
760792 }
761793
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+
762802 if ! projectdata .PlatformTxt ().ContainsKey ("compiler.optimization_flags.release" ) {
763803 return ruleresult .Skip , "Dependent property not present"
764804 }
@@ -780,6 +820,14 @@ func PlatformTxtCompilerOptimizationFlagsReleaseMissing() (result ruleresult.Typ
780820 return ruleresult .NotRun , "Couldn't load platform.txt"
781821 }
782822
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+
783831 if ! projectdata .PlatformTxt ().ContainsKey ("compiler.optimization_flags.debug" ) {
784832 return ruleresult .Skip , "Dependent property not present"
785833 }
@@ -801,6 +849,14 @@ func PlatformTxtCompilerCExtraFlagsMissing() (result ruleresult.Type, output str
801849 return ruleresult .NotRun , "Couldn't load platform.txt"
802850 }
803851
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+
804860 if schema .RequiredPropertyMissing ("compiler\\ .c\\ .extra_flags" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Strict ]) {
805861 return ruleresult .Fail , ""
806862 }
@@ -839,6 +895,14 @@ func PlatformTxtCompilerCppExtraFlagsMissing() (result ruleresult.Type, output s
839895 return ruleresult .NotRun , "Couldn't load platform.txt"
840896 }
841897
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+
842906 if schema .RequiredPropertyMissing ("compiler\\ .cpp\\ .extra_flags" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Strict ]) {
843907 return ruleresult .Fail , ""
844908 }
@@ -877,6 +941,14 @@ func PlatformTxtCompilerSExtraFlagsMissing() (result ruleresult.Type, output str
877941 return ruleresult .NotRun , "Couldn't load platform.txt"
878942 }
879943
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+
880952 if schema .RequiredPropertyMissing ("compiler\\ .S\\ .extra_flags" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Strict ]) {
881953 return ruleresult .Fail , ""
882954 }
@@ -915,6 +987,14 @@ func PlatformTxtCompilerArExtraFlagsMissing() (result ruleresult.Type, output st
915987 return ruleresult .NotRun , "Couldn't load platform.txt"
916988 }
917989
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+
918998 if schema .RequiredPropertyMissing ("compiler\\ .ar\\ .extra_flags" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Strict ]) {
919999 return ruleresult .Fail , ""
9201000 }
@@ -953,6 +1033,14 @@ func PlatformTxtCompilerCElfExtraFlagsMissing() (result ruleresult.Type, output
9531033 return ruleresult .NotRun , "Couldn't load platform.txt"
9541034 }
9551035
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+
9561044 if schema .RequiredPropertyMissing ("compiler\\ .c\\ .elf\\ .extra_flags" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Strict ]) {
9571045 return ruleresult .Fail , ""
9581046 }
@@ -1033,6 +1121,14 @@ func PlatformTxtRecipeCOPatternMissing() (result ruleresult.Type, output string)
10331121 return ruleresult .NotRun , "Couldn't load platform.txt"
10341122 }
10351123
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+
10361132 if schema .RequiredPropertyMissing ("recipe\\ .c\\ .o\\ .pattern" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Specification ]) {
10371133 return ruleresult .Fail , ""
10381134 }
@@ -1092,6 +1188,14 @@ func PlatformTxtRecipeCppOPatternMissing() (result ruleresult.Type, output strin
10921188 return ruleresult .NotRun , "Couldn't load platform.txt"
10931189 }
10941190
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+
10951199 if schema .RequiredPropertyMissing ("recipe\\ .cpp\\ .o\\ .pattern" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Specification ]) {
10961200 return ruleresult .Fail , ""
10971201 }
@@ -1151,6 +1255,14 @@ func PlatformTxtRecipeSOPatternMissing() (result ruleresult.Type, output string)
11511255 return ruleresult .NotRun , "Couldn't load platform.txt"
11521256 }
11531257
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+
11541266 if schema .RequiredPropertyMissing ("recipe\\ .S\\ .o\\ .pattern" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Specification ]) {
11551267 return ruleresult .Fail , ""
11561268 }
@@ -1210,6 +1322,14 @@ func PlatformTxtRecipeArPatternMissing() (result ruleresult.Type, output string)
12101322 return ruleresult .NotRun , "Couldn't load platform.txt"
12111323 }
12121324
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+
12131333 if schema .RequiredPropertyMissing ("recipe\\ .ar\\ .pattern" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Specification ]) {
12141334 return ruleresult .Fail , ""
12151335 }
@@ -1269,6 +1389,14 @@ func PlatformTxtRecipeCCombinePatternMissing() (result ruleresult.Type, output s
12691389 return ruleresult .NotRun , "Couldn't load platform.txt"
12701390 }
12711391
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+
12721400 if schema .RequiredPropertyMissing ("recipe\\ .c\\ .combine\\ .pattern" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Specification ]) {
12731401 return ruleresult .Fail , ""
12741402 }
@@ -1328,6 +1456,14 @@ func PlatformTxtRecipeOutputTmpFileMissing() (result ruleresult.Type, output str
13281456 return ruleresult .NotRun , "Couldn't load platform.txt"
13291457 }
13301458
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+
13311467 if schema .RequiredPropertyMissing ("recipe\\ .output\\ .tmp_file" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Specification ]) {
13321468 return ruleresult .Fail , ""
13331469 }
@@ -1366,6 +1502,14 @@ func PlatformTxtRecipeOutputSaveFileMissing() (result ruleresult.Type, output st
13661502 return ruleresult .NotRun , "Couldn't load platform.txt"
13671503 }
13681504
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+
13691513 if schema .RequiredPropertyMissing ("recipe\\ .output\\ .save_file" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Specification ]) {
13701514 return ruleresult .Fail , ""
13711515 }
@@ -1404,6 +1548,14 @@ func PlatformTxtRecipeSizePatternMissing() (result ruleresult.Type, output strin
14041548 return ruleresult .NotRun , "Couldn't load platform.txt"
14051549 }
14061550
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+
14071559 if schema .RequiredPropertyMissing ("recipe\\ .size\\ .pattern" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Strict ]) {
14081560 return ruleresult .Fail , ""
14091561 }
@@ -1442,6 +1594,14 @@ func PlatformTxtRecipeSizeRegexMissing() (result ruleresult.Type, output string)
14421594 return ruleresult .NotRun , "Couldn't load platform.txt"
14431595 }
14441596
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+
14451605 if schema .RequiredPropertyMissing ("recipe\\ .size\\ .regex" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Strict ]) {
14461606 return ruleresult .Fail , ""
14471607 }
@@ -1459,6 +1619,14 @@ func PlatformTxtRecipeSizeRegexDataMissing() (result ruleresult.Type, output str
14591619 return ruleresult .NotRun , "Couldn't load platform.txt"
14601620 }
14611621
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+
14621630 if schema .RequiredPropertyMissing ("recipe\\ .size\\ .regex\\ .data" , projectdata .PlatformTxtSchemaValidationResult ()[compliancelevel .Strict ]) {
14631631 return ruleresult .Fail , ""
14641632 }
@@ -1892,3 +2060,26 @@ func iDValuePatternMismatch(iDs []string, propertyNameQuery string, validationRe
18922060
18932061 return nonCompliantIDs
18942062}
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