diff --git a/check/checkconfigurations/checkconfigurations.go b/check/checkconfigurations/checkconfigurations.go index 268a470dd..c3354749e 100644 --- a/check/checkconfigurations/checkconfigurations.go +++ b/check/checkconfigurations/checkconfigurations.go @@ -656,6 +656,21 @@ var configurations = []Type{ ErrorModes: nil, CheckFunction: checkfunctions.LibraryPropertiesDependsFieldNotInIndex, }, + { + ProjectType: projecttype.Library, + Category: "library.properties", + Subcategory: "dot_a_linkage field", + ID: "", + Brief: "invalid value", + Description: "", + MessageTemplate: "invalid dot_a_linkage field value {{.}} in library.properties. See https://arduino.github.io/arduino-cli/latest/library-specification/#libraryproperties-file-format", + DisableModes: nil, + EnableModes: []checkmode.Type{checkmode.All}, + InfoModes: nil, + WarningModes: []checkmode.Type{checkmode.Permissive}, + ErrorModes: []checkmode.Type{checkmode.Default}, + CheckFunction: checkfunctions.LibraryPropertiesDotALinkageFieldInvalid, + }, { ProjectType: projecttype.Sketch, Category: "structure", diff --git a/check/checkfunctions/library.go b/check/checkfunctions/library.go index 9a233ec2d..9b1f92981 100644 --- a/check/checkfunctions/library.go +++ b/check/checkfunctions/library.go @@ -670,6 +670,24 @@ func LibraryPropertiesDependsFieldNotInIndex() (result checkresult.Type, output return checkresult.Pass, "" } +// LibraryPropertiesDotALinkageFieldInvalid checks for invalid value in the library.properties "dot_a_linkage" field. +func LibraryPropertiesDotALinkageFieldInvalid() (result checkresult.Type, output string) { + if checkdata.LibraryPropertiesLoadError() != nil { + return checkresult.NotRun, "" + } + + dotALinkage, ok := checkdata.LibraryProperties().GetOk("dot_a_linkage") + if !ok { + return checkresult.NotRun, "" + } + + if schema.PropertyEnumMismatch("dot_a_linkage", checkdata.LibraryPropertiesSchemaValidationResult()[compliancelevel.Specification], configuration.SchemasPath()) { + return checkresult.Fail, dotALinkage + } + + return checkresult.Pass, "" +} + // spellCheckLibraryPropertiesFieldValue returns the value of the provided library.properties field with commonly misspelled words corrected. func spellCheckLibraryPropertiesFieldValue(fieldName string) (result checkresult.Type, output string) { if checkdata.LibraryPropertiesLoadError() != nil {