diff --git a/check/checkconfigurations/checkconfigurations.go b/check/checkconfigurations/checkconfigurations.go index 360838ae..8e95fee7 100644 --- a/check/checkconfigurations/checkconfigurations.go +++ b/check/checkconfigurations/checkconfigurations.go @@ -731,6 +731,21 @@ var configurations = []Type{ ErrorModes: []checkmode.Type{checkmode.Default}, CheckFunction: checkfunctions.LibraryPropertiesPrecompiledFieldEnabledWithFlatLayout, }, + { + ProjectType: projecttype.Library, + Category: "library.properties", + Subcategory: "ldflags field", + ID: "", + Brief: "ldflags < min length", + Description: "", + MessageTemplate: "library.properties ldflags value is less than minimum length.", + DisableModes: nil, + EnableModes: []checkmode.Type{checkmode.All}, + InfoModes: nil, + WarningModes: []checkmode.Type{checkmode.Permissive}, + ErrorModes: []checkmode.Type{checkmode.Default}, + CheckFunction: checkfunctions.LibraryPropertiesLdflagsFieldLTMinLength, + }, { ProjectType: projecttype.Sketch, Category: "structure", diff --git a/check/checkfunctions/library.go b/check/checkfunctions/library.go index 6cbc148d..6cf5afc6 100644 --- a/check/checkfunctions/library.go +++ b/check/checkfunctions/library.go @@ -759,6 +759,19 @@ func LibraryPropertiesPrecompiledFieldEnabledWithFlatLayout() (result checkresul return checkresult.Pass, "" } +// LibraryPropertiesLdflagsFieldLTMinLength checks if the library.properties "ldflags" value is less than the minimum length. +func LibraryPropertiesLdflagsFieldLTMinLength() (result checkresult.Type, output string) { + if checkdata.LibraryPropertiesLoadError() != nil { + return checkresult.NotRun, "" + } + + if schema.PropertyLessThanMinLength("ldflags", 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 {