Skip to content

Commit 36204a0

Browse files
authored
Increase recommended library name length to 32 (#511)
The previous maximum recommend library name length, according to rule LP010, was 16 characters. This limit was determined to be unrealistic. For example, once Arduino library authors have added the required "Arduino_" prefix, half the available characters are used up. Even though it is only a recommendation, resulting in a warning when Arduino Lint is ran in "permissive" or "specification" compliance modes, it is an error in "strict" mode. This impossibility of complying with LP010 is the sole reason for the strict compliance level being used in the CI systems of several of Arduino's libraries.
1 parent ca0f618 commit 36204a0

File tree

6 files changed

+5
-5
lines changed

6 files changed

+5
-5
lines changed

Diff for: etc/schemas/arduino-library-properties-definitions-schema.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
"$ref": "#/definitions/propertiesObjects/name/specification/object"
9292
},
9393
{
94-
"maxLength": 16
94+
"maxLength": 32
9595
},
9696
{
9797
"$ref": "#/definitions/propertiesObjects/name/strict/definitions/patternObjects/notContainsSpaces"

Diff for: internal/rule/ruleconfiguration/ruleconfiguration.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ var configurations = []Type{
424424
ID: "LP010",
425425
Brief: "name > recommended length",
426426
Description: "The `name` field in the library's `library.properties` metadata file is longer than the recommended length. As the unique identifier for the library, the name will be typed by the users of command line tools (e.g., `arduino-cli lib install Servo`). For this reason, it is best practices to avoid unnecessary name length.",
427-
MessageTemplate: "library.properties name value {{.}} is longer than the recommended length of 16 characters.",
427+
MessageTemplate: "library.properties name value {{.}} is longer than the recommended length of 32 characters.",
428428
Reference: "https://arduino.github.io/arduino-cli/latest/library-specification/#libraryproperties-file-format",
429429
DisableModes: nil,
430430
EnableModes: []rulemode.Type{rulemode.Default},

Diff for: internal/rule/rulefunction/library_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ func TestLibraryPropertiesNameFieldGTRecommendedLength(t *testing.T) {
297297
testTables := []libraryRuleFunctionTestTable{
298298
{"Invalid", "InvalidLibraryProperties", ruleresult.NotRun, ""},
299299
{"Legacy", "Legacy", ruleresult.NotRun, ""},
300-
{"Name field longer than recommended", "NameGTRecommendedLength", ruleresult.Fail, ""},
300+
{"Name field longer than recommended", "NameIsBiggerThanRecommendedLength", ruleresult.Fail, ""},
301301
{"Valid", "Recursive", ruleresult.Pass, ""},
302302
}
303303

Diff for: internal/rule/rulefunction/testdata/libraries/NameGTRecommendedLength/library.properties renamed to internal/rule/rulefunction/testdata/libraries/NameIsBiggerThanRecommendedLength/library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name=NameGTRecommendedLength
1+
name=NameIsBiggerThanRecommendedLength
22
version=1.0.0
33
author=Cristian Maglie <[email protected]>, Pippo Pluto <[email protected]>
44
maintainer=Cristian Maglie <[email protected]>

Diff for: internal/rule/schema/schemadata/bindata.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1509,7 +1509,7 @@ var _arduinoLibraryPropertiesDefinitionsSchemaJson = []byte(`{
15091509
"$ref": "#/definitions/propertiesObjects/name/specification/object"
15101510
},
15111511
{
1512-
"maxLength": 16
1512+
"maxLength": 32
15131513
},
15141514
{
15151515
"$ref": "#/definitions/propertiesObjects/name/strict/definitions/patternObjects/notContainsSpaces"

0 commit comments

Comments
 (0)