Skip to content

Commit c0d9f38

Browse files
committed
Make depends in index check support spaces in library names
1 parent 331e48f commit c0d9f38

File tree

5 files changed

+18
-5
lines changed

5 files changed

+18
-5
lines changed

Diff for: check/checkfunctions/library.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -841,12 +841,14 @@ func LibraryPropertiesDependsFieldNotInIndex() (result checkresult.Type, output
841841
return checkresult.NotRun, "Field not present"
842842
}
843843

844-
dependencies, err := properties.SplitQuotedString(depends, "", false)
845-
if err != nil {
846-
panic(err)
847-
}
844+
dependencies := strings.Split(depends, ",")
845+
848846
dependenciesNotInIndex := []string{}
849847
for _, dependency := range dependencies {
848+
dependency = strings.TrimSpace(dependency)
849+
if dependency == "" {
850+
continue
851+
}
850852
logrus.Tracef("Checking if dependency %s is in index.", dependency)
851853
if !nameInLibraryManagerIndex(dependency) {
852854
dependenciesNotInIndex = append(dependenciesNotInIndex, dependency)

Diff for: check/checkfunctions/library_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ func TestLibraryPropertiesDependsFieldNotInIndex(t *testing.T) {
309309
{"Unable to load", "InvalidLibraryProperties", checkresult.NotRun, ""},
310310
{"Dependency not in index", "DependsNotIndexed", checkresult.Fail, "^NotIndexed$"},
311311
{"Dependency in index", "DependsIndexed", checkresult.Pass, ""},
312+
{"Depends field empty", "DependsEmpty", checkresult.Pass, ""},
312313
{"No depends", "NoDepends", checkresult.NotRun, ""},
313314
}
314315

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name=DependsEmpty
2+
version=1.0.0
3+
author=Cristian Maglie <[email protected]>, Pippo Pluto <[email protected]>
4+
maintainer=Cristian Maglie <[email protected]>
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+
depends=

Diff for: check/checkfunctions/testdata/libraries/DependsEmpty/src/DependsEmpty.h

Whitespace-only changes.

Diff for: check/checkfunctions/testdata/libraries/DependsIndexed/library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ paragraph=Supports HTTP1.1 and you can do GET and POST.
77
category=Communication
88
url=http://example.com/
99
architectures=avr
10-
depends=Servo
10+
depends=Servo, , Adafruit NeoPixel

0 commit comments

Comments
 (0)