diff --git a/check/checkconfigurations/checkconfigurations.go b/check/checkconfigurations/checkconfigurations.go index 8e95fee7..27a1ea49 100644 --- a/check/checkconfigurations/checkconfigurations.go +++ b/check/checkconfigurations/checkconfigurations.go @@ -746,6 +746,21 @@ var configurations = []Type{ ErrorModes: []checkmode.Type{checkmode.Default}, CheckFunction: checkfunctions.LibraryPropertiesLdflagsFieldLTMinLength, }, + { + ProjectType: projecttype.Library, + Category: "library.properties", + Subcategory: "general", + ID: "", + Brief: "misspelled field", + Description: "", + MessageTemplate: "Potentially misspelled library.properties field name detected. 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.All}, + ErrorModes: nil, + CheckFunction: checkfunctions.LibraryPropertiesMisspelledOptionalField, + }, { ProjectType: projecttype.Sketch, Category: "structure", diff --git a/check/checkfunctions/library.go b/check/checkfunctions/library.go index 6cf5afc6..8ff945da 100644 --- a/check/checkfunctions/library.go +++ b/check/checkfunctions/library.go @@ -772,6 +772,19 @@ func LibraryPropertiesLdflagsFieldLTMinLength() (result checkresult.Type, output return checkresult.Pass, "" } +// LibraryPropertiesMisspelledOptionalField checks if library.properties contains common misspellings of optional fields. +func LibraryPropertiesMisspelledOptionalField() (result checkresult.Type, output string) { + if checkdata.LibraryPropertiesLoadError() != nil { + return checkresult.NotRun, "" + } + + if schema.MisspelledOptionalPropertyFound(checkdata.LibraryPropertiesSchemaValidationResult()[compliancelevel.Specification], configuration.SchemasPath()) { + return checkresult.Fail, "" + } + + 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 {