Skip to content

Commit 918d845

Browse files
committed
Refactor .pde sketch check function's output code
1 parent 2fe0250 commit 918d845

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

check/checkfunctions/sketch.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,24 @@ package checkfunctions
33
// The check functions for sketches.
44

55
import (
6+
"strings"
7+
68
"github.com/arduino/arduino-check/check/checkdata"
79
"github.com/arduino/arduino-check/check/checkresult"
810
)
911

1012
func PdeSketchExtension() (result checkresult.Type, output string) {
1113
directoryListing, _ := checkdata.ProjectPath().ReadDir()
1214
directoryListing.FilterOutDirs()
13-
pdeSketches := ""
15+
pdeSketches := []string{}
1416
for _, filePath := range directoryListing {
1517
if filePath.Ext() == ".pde" {
16-
if pdeSketches == "" {
17-
pdeSketches = filePath.Base()
18-
} else {
19-
pdeSketches += ", " + filePath.Base()
20-
}
18+
pdeSketches = append(pdeSketches, filePath.Base())
2119
}
2220
}
2321

24-
if pdeSketches != "" {
25-
return checkresult.Fail, pdeSketches
22+
if len(pdeSketches) > 0 {
23+
return checkresult.Fail, strings.Join(pdeSketches, ", ")
2624
}
2725

2826
return checkresult.Pass, ""

0 commit comments

Comments
 (0)