A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/arduino/arduino-lint/commit/f3024198aee0b495f38644f1e2dc53ea439b6dab below:

Add min length rule for library.properties url field · arduino/arduino-lint@f302419 · GitHub

File tree Expand file treeCollapse file tree 7 files changed

+60

-0

lines changed

Filter options

Expand file treeCollapse file tree 7 files changed

+60

-0

lines changed Original file line number Diff line number Diff line change

@@ -413,6 +413,9 @@

413 413

"allOf": [

414 414

{

415 415

"type": "string"

416 +

},

417 +

{

418 +

"minLength": 1

416 419

}

417 420

]

418 421

}

Original file line number Diff line number Diff line change

@@ -889,6 +889,22 @@ var configurations = []Type{

889 889

ErrorModes: []rulemode.Type{rulemode.Default},

890 890

RuleFunction: rulefunction.LibraryPropertiesUrlFieldMissing,

891 891

},

892 +

{

893 +

ProjectType: projecttype.Library,

894 +

SuperprojectType: projecttype.All,

895 +

Category: "library.properties",

896 +

Subcategory: "url field",

897 +

ID: "LP056",

898 +

Brief: "url < min length",

899 +

Description: "",

900 +

MessageTemplate: "library.properties url value is less than minimum length.",

901 +

DisableModes: nil,

902 +

EnableModes: []rulemode.Type{rulemode.Default},

903 +

InfoModes: nil,

904 +

WarningModes: nil,

905 +

ErrorModes: []rulemode.Type{rulemode.Default},

906 +

RuleFunction: rulefunction.LibraryPropertiesUrlFieldLTMinLength,

907 +

},

892 908

{

893 909

ProjectType: projecttype.Library,

894 910

SuperprojectType: projecttype.All,

Original file line number Diff line number Diff line change

@@ -944,6 +944,23 @@ func LibraryPropertiesUrlFieldMissing() (result ruleresult.Type, output string)

944 944

return ruleresult.Pass, ""

945 945

}

946 946 947 +

// LibraryPropertiesUrlFieldLTMinLength checks if the library.properties "url" value is less than the minimum length.

948 +

func LibraryPropertiesUrlFieldLTMinLength() (result ruleresult.Type, output string) {

949 +

if projectdata.LibraryPropertiesLoadError() != nil {

950 +

return ruleresult.NotRun, "Couldn't load library.properties"

951 +

}

952 + 953 +

if !projectdata.LibraryProperties().ContainsKey("url") {

954 +

return ruleresult.NotRun, "Field not present"

955 +

}

956 + 957 +

if schema.PropertyLessThanMinLength("url", projectdata.LibraryPropertiesSchemaValidationResult()[compliancelevel.Permissive]) {

958 +

return ruleresult.Fail, ""

959 +

}

960 + 961 +

return ruleresult.Pass, ""

962 +

}

963 + 947 964

// LibraryPropertiesUrlFieldInvalid checks whether the library.properties "url" value has a valid URL format.

948 965

func LibraryPropertiesUrlFieldInvalid() (result ruleresult.Type, output string) {

949 966

if projectdata.LibraryPropertiesLoadError() != nil {

Original file line number Diff line number Diff line change

@@ -714,6 +714,17 @@ func TestLibraryPropertiesUrlFieldMissing(t *testing.T) {

714 714

checkLibraryRuleFunction(LibraryPropertiesUrlFieldMissing, testTables, t)

715 715

}

716 716 717 +

func TestLibraryPropertiesUrlFieldLTMinLength(t *testing.T) {

718 +

testTables := []libraryRuleFunctionTestTable{

719 +

{"Invalid", "InvalidLibraryProperties", ruleresult.NotRun, ""},

720 +

{"Legacy", "Legacy", ruleresult.NotRun, ""},

721 +

{"url field too short", "UrlLTMinLength", ruleresult.Fail, ""},

722 +

{"Valid", "Recursive", ruleresult.Pass, ""},

723 +

}

724 + 725 +

checkLibraryRuleFunction(LibraryPropertiesUrlFieldLTMinLength, testTables, t)

726 +

}

727 + 717 728

func TestLibraryPropertiesUrlFieldInvalid(t *testing.T) {

718 729

testTables := []libraryRuleFunctionTestTable{

719 730

{"Invalid", "InvalidLibraryProperties", ruleresult.NotRun, ""},

Original file line number Diff line number Diff line change

@@ -0,0 +1,10 @@

1 +

name=UrlLTMinLength

2 +

version=1.0.0

3 +

author=Cristian Maglie <c.maglie@example.com>, Pippo Pluto <pippo@example.com>

4 +

maintainer=Cristian Maglie <c.maglie@example.com>

5 +

sentence=A library that makes coding a web server a breeze.

6 +

paragraph=Supports HTTP1.1 and you can do GET and POST.

7 +

category=Communication

8 +

url=

9 +

architectures=avr

10 +

includes=UrlLTMinLength.h

Original file line number Diff line number Diff line change

@@ -1832,6 +1832,9 @@ var _arduinoLibraryPropertiesDefinitionsSchemaJson = []byte(`{

1832 1832

"allOf": [

1833 1833

{

1834 1834

"type": "string"

1835 +

},

1836 +

{

1837 +

"minLength": 1

1835 1838

}

1836 1839

]

1837 1840

}

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4