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/e98b7d31b118047fd80c39937685e751900e3aaf below:

Add rule for 3rd party library.properties maintainer using "Arduino" · arduino/arduino-lint@e98b7d3 · GitHub

File tree Expand file treeCollapse file tree 8 files changed

+76

-12

lines changed

Filter options

Expand file treeCollapse file tree 8 files changed

+76

-12

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

@@ -10,6 +10,11 @@

10 10

"not": {

11 11

"pattern": "^[aA][rR][dD][uU][iI][nN][oO].*$"

12 12

}

13 +

},

14 +

"notContainsArduino": {

15 +

"not": {

16 +

"pattern": "^.+[aA][rR][dD][uU][iI][nN][oO].*$"

17 +

}

13 18

}

14 19

}

15 20

},

@@ -77,11 +82,6 @@

77 82

"pattern": "^.* .*$"

78 83

}

79 84

},

80 -

"notContainsArduino": {

81 -

"not": {

82 -

"pattern": "^.+[aA][rR][dD][uU][iI][nN][oO].*$"

83 -

}

84 -

},

85 85

"notContainsSuperfluousTerms": {

86 86

"not": {

87 87

"pattern": "^.*[lL][iI][bB][rR][aA][rR][yY].*$"

@@ -101,7 +101,7 @@

101 101

"$ref": "#/definitions/propertiesObjects/name/strict/definitions/patternObjects/notContainsSpaces"

102 102

},

103 103

{

104 -

"$ref": "#/definitions/propertiesObjects/name/strict/definitions/patternObjects/notContainsArduino"

104 +

"$ref": "#/definitions/general/patternObjects/notContainsArduino"

105 105

},

106 106

{

107 107

"$ref": "#/definitions/propertiesObjects/name/strict/definitions/patternObjects/notContainsSuperfluousTerms"

@@ -238,6 +238,9 @@

238 238

"allOf": [

239 239

{

240 240

"$ref": "#/definitions/propertiesObjects/maintainer/specification/object"

241 +

},

242 +

{

243 +

"$ref": "#/definitions/general/patternObjects/notContainsArduino"

241 244

}

242 245

]

243 246

}

Original file line number Diff line number Diff line change

@@ -291,8 +291,11 @@ func TestPropertiesVersionPattern(t *testing.T) {

291 291

func TestPropertiesMaintainerPattern(t *testing.T) {

292 292

testTables := []propertyValueTestTable{

293 293

{"Starts with arduino", "arduinofoo", compliancelevel.Permissive, assert.False},

294 +

{"Contains arduino", "fooarduinobar", compliancelevel.Permissive, assert.False},

294 295

{"Starts with arduino", "arduinofoo", compliancelevel.Specification, assert.True},

296 +

{"Contains arduino", "fooarduinobar", compliancelevel.Specification, assert.False},

295 297

{"Starts with arduino", "arduinofoo", compliancelevel.Strict, assert.True},

298 +

{"Contains arduino", "fooarduinobar", compliancelevel.Strict, assert.True},

296 299

}

297 300 298 301

checkPropertyPatternMismatch("maintainer", testTables, t)

Original file line number Diff line number Diff line change

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

681 681

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

682 682

RuleFunction: rulefunction.LibraryPropertiesMaintainerFieldStartsWithArduino,

683 683

},

684 +

{

685 +

ProjectType: projecttype.Library,

686 +

SuperprojectType: projecttype.All,

687 +

Category: "library.properties",

688 +

Subcategory: "maintainer field",

689 +

ID: "LP057",

690 +

Brief: `maintainer contains "Arduino"`,

691 +

Description: "Case insensitive.",

692 +

MessageTemplate: `library.properties maintainer value {{.}} contains "Arduino". 3rd party libraries are not maintained by Arduino.`,

693 +

DisableModes: []rulemode.Type{rulemode.Official},

694 +

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

695 +

InfoModes: nil,

696 +

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

697 +

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

698 +

RuleFunction: rulefunction.LibraryPropertiesMaintainerFieldContainsArduino,

699 +

},

684 700

{

685 701

ProjectType: projecttype.Library,

686 702

SuperprojectType: projecttype.All,

Original file line number Diff line number Diff line change

@@ -744,6 +744,24 @@ func LibraryPropertiesMaintainerFieldStartsWithArduino() (result ruleresult.Type

744 744

return ruleresult.Pass, ""

745 745

}

746 746 747 +

// LibraryPropertiesMaintainerFieldContainsArduino checks if the library.properties "maintainer" value contains "Arduino".

748 +

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

749 +

if projectdata.LibraryPropertiesLoadError() != nil {

750 +

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

751 +

}

752 + 753 +

maintainer, ok := projectdata.LibraryProperties().GetOk("maintainer")

754 +

if !ok {

755 +

return ruleresult.NotRun, "Field not present"

756 +

}

757 + 758 +

if schema.ValidationErrorMatch("^#/maintainer$", "/patternObjects/notContainsArduino", "", "", projectdata.LibraryPropertiesSchemaValidationResult()[compliancelevel.Strict]) {

759 +

return ruleresult.Fail, maintainer

760 +

}

761 + 762 +

return ruleresult.Pass, ""

763 +

}

764 + 747 765

// LibraryPropertiesEmailFieldAsMaintainerAlias checks whether the library.properties "email" field is being used as an alias for the "maintainer" field.

748 766

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

749 767

if projectdata.LibraryPropertiesLoadError() != nil {

Original file line number Diff line number Diff line change

@@ -568,6 +568,17 @@ func TestLibraryPropertiesMaintainerFieldStartsWithArduino(t *testing.T) {

568 568

checkLibraryRuleFunction(LibraryPropertiesMaintainerFieldStartsWithArduino, testTables, t)

569 569

}

570 570 571 +

func TestLibraryPropertiesMaintainerFieldContainsArduino(t *testing.T) {

572 +

testTables := []libraryRuleFunctionTestTable{

573 +

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

574 +

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

575 +

{"Maintainer field contains Arduino", "MaintainerContainsArduino", ruleresult.Fail, ""},

576 +

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

577 +

}

578 + 579 +

checkLibraryRuleFunction(LibraryPropertiesMaintainerFieldContainsArduino, testTables, t)

580 +

}

581 + 571 582

func TestLibraryPropertiesEmailFieldAsMaintainerAlias(t *testing.T) {

572 583

testTables := []libraryRuleFunctionTestTable{

573 584

{"Unable to load", "InvalidLibraryProperties", ruleresult.NotRun, ""},

Original file line number Diff line number Diff line change

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

1 +

name=MaintainerContainsArduino

2 +

version=1.0.0

3 +

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

4 +

maintainer=Cristian "Arduino Wizard" 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=http://example.com/

9 +

architectures=avr

10 +

includes=Recursive.h

Original file line number Diff line number Diff line change

@@ -1429,6 +1429,11 @@ var _arduinoLibraryPropertiesDefinitionsSchemaJson = []byte(`{

1429 1429

"not": {

1430 1430

"pattern": "^[aA][rR][dD][uU][iI][nN][oO].*$"

1431 1431

}

1432 +

},

1433 +

"notContainsArduino": {

1434 +

"not": {

1435 +

"pattern": "^.+[aA][rR][dD][uU][iI][nN][oO].*$"

1436 +

}

1432 1437

}

1433 1438

}

1434 1439

},

@@ -1496,11 +1501,6 @@ var _arduinoLibraryPropertiesDefinitionsSchemaJson = []byte(`{

1496 1501

"pattern": "^.* .*$"

1497 1502

}

1498 1503

},

1499 -

"notContainsArduino": {

1500 -

"not": {

1501 -

"pattern": "^.+[aA][rR][dD][uU][iI][nN][oO].*$"

1502 -

}

1503 -

},

1504 1504

"notContainsSuperfluousTerms": {

1505 1505

"not": {

1506 1506

"pattern": "^.*[lL][iI][bB][rR][aA][rR][yY].*$"

@@ -1520,7 +1520,7 @@ var _arduinoLibraryPropertiesDefinitionsSchemaJson = []byte(`{

1520 1520

"$ref": "#/definitions/propertiesObjects/name/strict/definitions/patternObjects/notContainsSpaces"

1521 1521

},

1522 1522

{

1523 -

"$ref": "#/definitions/propertiesObjects/name/strict/definitions/patternObjects/notContainsArduino"

1523 +

"$ref": "#/definitions/general/patternObjects/notContainsArduino"

1524 1524

},

1525 1525

{

1526 1526

"$ref": "#/definitions/propertiesObjects/name/strict/definitions/patternObjects/notContainsSuperfluousTerms"

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

1657 1657

"allOf": [

1658 1658

{

1659 1659

"$ref": "#/definitions/propertiesObjects/maintainer/specification/object"

1660 +

},

1661 +

{

1662 +

"$ref": "#/definitions/general/patternObjects/notContainsArduino"

1660 1663

}

1661 1664

]

1662 1665

}

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