Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions check/checkconfigurations/checkconfigurations.go
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,21 @@ var configurations = []Type{
ErrorModes: []checkmode.Type{checkmode.Default},
CheckFunction: checkfunctions.LibraryPropertiesDotALinkageFieldTrueWithFlatLayout,
},
{
ProjectType: projecttype.Library,
Category: "library.properties",
Subcategory: "includes field",
ID: "",
Brief: "includes blank",
Description: `Caused the "Sketch > Include library" feature of previous IDE versions to add an empty #include directive to the sketch.`,
MessageTemplate: "Empty library.properties includes field. Please either define includes or remove this optional field. 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.LibraryPropertiesIncludesFieldLTMinLength,
},
{
ProjectType: projecttype.Library,
Category: "library.properties",
Expand Down
17 changes: 17 additions & 0 deletions check/checkfunctions/library.go
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,23 @@ func LibraryPropertiesDotALinkageFieldTrueWithFlatLayout() (result checkresult.T
return checkresult.Pass, ""
}

// LibraryPropertiesNameFieldLTMinLength checks if the library.properties "includes" value is less than the minimum length.
func LibraryPropertiesIncludesFieldLTMinLength() (result checkresult.Type, output string) {
if checkdata.LibraryPropertiesLoadError() != nil {
return checkresult.NotRun, ""
}

if !checkdata.LibraryProperties().ContainsKey("includes") {
return checkresult.NotRun, ""
}

if schema.PropertyLessThanMinLength("includes", checkdata.LibraryPropertiesSchemaValidationResult()[compliancelevel.Specification], configuration.SchemasPath()) {
return checkresult.Fail, ""
}

return checkresult.Pass, ""
}

// LibraryPropertiesPrecompiledFieldEnabledWithFlatLayout checks whether a precompiled library has the required recursive layout type.
func LibraryPropertiesPrecompiledFieldEnabledWithFlatLayout() (result checkresult.Type, output string) {
if checkdata.LoadedLibrary() == nil || checkdata.LibraryPropertiesLoadError() != nil {
Expand Down