From ea63a33445d7a397e3ecd5eee8fe5f1d8f4e31df Mon Sep 17 00:00:00 2001 From: Ali Jahangiri <75624145+aliphys@users.noreply.github.com> Date: Mon, 13 Mar 2023 18:14:56 +0100 Subject: [PATCH 1/5] Change "maxLength" value from 16 to 64 --- etc/schemas/arduino-library-properties-definitions-schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/schemas/arduino-library-properties-definitions-schema.json b/etc/schemas/arduino-library-properties-definitions-schema.json index b7238e50..dc7ac465 100644 --- a/etc/schemas/arduino-library-properties-definitions-schema.json +++ b/etc/schemas/arduino-library-properties-definitions-schema.json @@ -91,7 +91,7 @@ "$ref": "#/definitions/propertiesObjects/name/specification/object" }, { - "maxLength": 16 + "maxLength": 64 }, { "$ref": "#/definitions/propertiesObjects/name/strict/definitions/patternObjects/notContainsSpaces" From e8502956847a1b9bc9abba413551c937fc35a4a4 Mon Sep 17 00:00:00 2001 From: Ali Jahangiri <75624145+aliphys@users.noreply.github.com> Date: Mon, 13 Mar 2023 18:26:30 +0100 Subject: [PATCH 2/5] Update LP010 message --- internal/rule/ruleconfiguration/ruleconfiguration.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/rule/ruleconfiguration/ruleconfiguration.go b/internal/rule/ruleconfiguration/ruleconfiguration.go index 0df9b8bc..0c7317af 100644 --- a/internal/rule/ruleconfiguration/ruleconfiguration.go +++ b/internal/rule/ruleconfiguration/ruleconfiguration.go @@ -424,7 +424,7 @@ var configurations = []Type{ ID: "LP010", Brief: "name > recommended length", 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.", - MessageTemplate: "library.properties name value {{.}} is longer than the recommended length of 16 characters.", + MessageTemplate: "library.properties name value {{.}} is longer than the recommended length of 64 characters.", Reference: "https://arduino.github.io/arduino-cli/latest/library-specification/#libraryproperties-file-format", DisableModes: nil, EnableModes: []rulemode.Type{rulemode.Default}, From 629e77468ceb3b06a21536bb239544773ad8f072 Mon Sep 17 00:00:00 2001 From: Ali Jahangiri <75624145+aliphys@users.noreply.github.com> Date: Thu, 16 Mar 2023 10:08:08 +0100 Subject: [PATCH 3/5] 32 characters is enough for library name --- etc/schemas/arduino-library-properties-definitions-schema.json | 2 +- internal/rule/ruleconfiguration/ruleconfiguration.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/schemas/arduino-library-properties-definitions-schema.json b/etc/schemas/arduino-library-properties-definitions-schema.json index dc7ac465..5fec6deb 100644 --- a/etc/schemas/arduino-library-properties-definitions-schema.json +++ b/etc/schemas/arduino-library-properties-definitions-schema.json @@ -91,7 +91,7 @@ "$ref": "#/definitions/propertiesObjects/name/specification/object" }, { - "maxLength": 64 + "maxLength": 32 }, { "$ref": "#/definitions/propertiesObjects/name/strict/definitions/patternObjects/notContainsSpaces" diff --git a/internal/rule/ruleconfiguration/ruleconfiguration.go b/internal/rule/ruleconfiguration/ruleconfiguration.go index 0c7317af..b69b418a 100644 --- a/internal/rule/ruleconfiguration/ruleconfiguration.go +++ b/internal/rule/ruleconfiguration/ruleconfiguration.go @@ -424,7 +424,7 @@ var configurations = []Type{ ID: "LP010", Brief: "name > recommended length", 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.", - MessageTemplate: "library.properties name value {{.}} is longer than the recommended length of 64 characters.", + MessageTemplate: "library.properties name value {{.}} is longer than the recommended length of 32 characters.", Reference: "https://arduino.github.io/arduino-cli/latest/library-specification/#libraryproperties-file-format", DisableModes: nil, EnableModes: []rulemode.Type{rulemode.Default}, From 4ea2ce2590cdb0bf6ae7cda2b4bfeb1201456d57 Mon Sep 17 00:00:00 2001 From: Ali Jahangiri <75624145+aliphys@users.noreply.github.com> Date: Fri, 17 Mar 2023 13:02:31 +0100 Subject: [PATCH 4/5] Change schema maxLength to 32 --- internal/rule/schema/schemadata/bindata.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/rule/schema/schemadata/bindata.go b/internal/rule/schema/schemadata/bindata.go index 9281a852..31638bf0 100644 --- a/internal/rule/schema/schemadata/bindata.go +++ b/internal/rule/schema/schemadata/bindata.go @@ -1509,7 +1509,7 @@ var _arduinoLibraryPropertiesDefinitionsSchemaJson = []byte(`{ "$ref": "#/definitions/propertiesObjects/name/specification/object" }, { - "maxLength": 16 + "maxLength": 32 }, { "$ref": "#/definitions/propertiesObjects/name/strict/definitions/patternObjects/notContainsSpaces" From b0f7c8a27b3eca5a87732cc8e20ccf436028d316 Mon Sep 17 00:00:00 2001 From: Ali Jahangiri <75624145+aliphys@users.noreply.github.com> Date: Fri, 17 Mar 2023 13:14:14 +0100 Subject: [PATCH 5/5] Change test name to NameGTRecommendedLength --- internal/rule/rulefunction/library_test.go | 2 +- .../library.properties | 2 +- .../src/NameIsBiggerThanRecommendedLength.h} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename internal/rule/rulefunction/testdata/libraries/{NameGTRecommendedLength => NameIsBiggerThanRecommendedLength}/library.properties (89%) rename internal/rule/rulefunction/testdata/libraries/{NameGTRecommendedLength/src/NameGTRecommendedLength.h => NameIsBiggerThanRecommendedLength/src/NameIsBiggerThanRecommendedLength.h} (100%) diff --git a/internal/rule/rulefunction/library_test.go b/internal/rule/rulefunction/library_test.go index 2b5b35f2..a0ccf937 100644 --- a/internal/rule/rulefunction/library_test.go +++ b/internal/rule/rulefunction/library_test.go @@ -297,7 +297,7 @@ func TestLibraryPropertiesNameFieldGTRecommendedLength(t *testing.T) { testTables := []libraryRuleFunctionTestTable{ {"Invalid", "InvalidLibraryProperties", ruleresult.NotRun, ""}, {"Legacy", "Legacy", ruleresult.NotRun, ""}, - {"Name field longer than recommended", "NameGTRecommendedLength", ruleresult.Fail, ""}, + {"Name field longer than recommended", "NameIsBiggerThanRecommendedLength", ruleresult.Fail, ""}, {"Valid", "Recursive", ruleresult.Pass, ""}, } diff --git a/internal/rule/rulefunction/testdata/libraries/NameGTRecommendedLength/library.properties b/internal/rule/rulefunction/testdata/libraries/NameIsBiggerThanRecommendedLength/library.properties similarity index 89% rename from internal/rule/rulefunction/testdata/libraries/NameGTRecommendedLength/library.properties rename to internal/rule/rulefunction/testdata/libraries/NameIsBiggerThanRecommendedLength/library.properties index af56227c..bcc48f53 100644 --- a/internal/rule/rulefunction/testdata/libraries/NameGTRecommendedLength/library.properties +++ b/internal/rule/rulefunction/testdata/libraries/NameIsBiggerThanRecommendedLength/library.properties @@ -1,4 +1,4 @@ -name=NameGTRecommendedLength +name=NameIsBiggerThanRecommendedLength version=1.0.0 author=Cristian Maglie , Pippo Pluto maintainer=Cristian Maglie diff --git a/internal/rule/rulefunction/testdata/libraries/NameGTRecommendedLength/src/NameGTRecommendedLength.h b/internal/rule/rulefunction/testdata/libraries/NameIsBiggerThanRecommendedLength/src/NameIsBiggerThanRecommendedLength.h similarity index 100% rename from internal/rule/rulefunction/testdata/libraries/NameGTRecommendedLength/src/NameGTRecommendedLength.h rename to internal/rule/rulefunction/testdata/libraries/NameIsBiggerThanRecommendedLength/src/NameIsBiggerThanRecommendedLength.h