Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docsgen/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ github.com/arduino/board-discovery v0.0.0-20180823133458-1ba29327fb0c/go.mod h1:
github.com/arduino/go-paths-helper v1.0.1/go.mod h1:HpxtKph+g238EJHq4geEPv9p+gl3v5YYu35Yb+w31Ck=
github.com/arduino/go-paths-helper v1.2.0/go.mod h1:HpxtKph+g238EJHq4geEPv9p+gl3v5YYu35Yb+w31Ck=
github.com/arduino/go-paths-helper v1.3.2/go.mod h1:HpxtKph+g238EJHq4geEPv9p+gl3v5YYu35Yb+w31Ck=
github.com/arduino/go-paths-helper v1.4.0 h1:ilnseAdxmN1bFnLxxXHRtcdmt9jBf3O4jtYfWfqule4=
github.com/arduino/go-paths-helper v1.4.0/go.mod h1:V82BWgAAp4IbmlybxQdk9Bpkz8M4Qyx+RAFKaG9NuvU=
github.com/arduino/go-paths-helper v1.6.1 h1:lha+/BuuBsx0qTZ3gy6IO1kU23lObWdQ/UItkzVWQ+0=
github.com/arduino/go-paths-helper v1.6.1/go.mod h1:V82BWgAAp4IbmlybxQdk9Bpkz8M4Qyx+RAFKaG9NuvU=
github.com/arduino/go-properties-orderedmap v1.3.0/go.mod h1:DKjD2VXY/NZmlingh4lSFMEYCVubfeArCsGPGDwb2yk=
github.com/arduino/go-properties-orderedmap v1.6.0 h1:gp2JoWRETtqwsZ+UHu/PBuYWYH2x2+d+uipDxS4WmvM=
github.com/arduino/go-properties-orderedmap v1.6.0/go.mod h1:DKjD2VXY/NZmlingh4lSFMEYCVubfeArCsGPGDwb2yk=
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/OneOfOne/xxhash v1.2.8 // indirect
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be // indirect
github.com/arduino/arduino-cli v0.0.0-20201210103408-bf7a3194bb63
github.com/arduino/go-paths-helper v1.4.0
github.com/arduino/go-paths-helper v1.6.1
github.com/arduino/go-properties-orderedmap v1.6.0
github.com/client9/misspell v0.3.4
github.com/daaku/go.zipexe v1.0.1 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ github.com/arduino/board-discovery v0.0.0-20180823133458-1ba29327fb0c/go.mod h1:
github.com/arduino/go-paths-helper v1.0.1/go.mod h1:HpxtKph+g238EJHq4geEPv9p+gl3v5YYu35Yb+w31Ck=
github.com/arduino/go-paths-helper v1.2.0/go.mod h1:HpxtKph+g238EJHq4geEPv9p+gl3v5YYu35Yb+w31Ck=
github.com/arduino/go-paths-helper v1.3.2/go.mod h1:HpxtKph+g238EJHq4geEPv9p+gl3v5YYu35Yb+w31Ck=
github.com/arduino/go-paths-helper v1.4.0 h1:ilnseAdxmN1bFnLxxXHRtcdmt9jBf3O4jtYfWfqule4=
github.com/arduino/go-paths-helper v1.4.0/go.mod h1:V82BWgAAp4IbmlybxQdk9Bpkz8M4Qyx+RAFKaG9NuvU=
github.com/arduino/go-paths-helper v1.6.1 h1:lha+/BuuBsx0qTZ3gy6IO1kU23lObWdQ/UItkzVWQ+0=
github.com/arduino/go-paths-helper v1.6.1/go.mod h1:V82BWgAAp4IbmlybxQdk9Bpkz8M4Qyx+RAFKaG9NuvU=
github.com/arduino/go-properties-orderedmap v1.3.0/go.mod h1:DKjD2VXY/NZmlingh4lSFMEYCVubfeArCsGPGDwb2yk=
github.com/arduino/go-properties-orderedmap v1.6.0 h1:gp2JoWRETtqwsZ+UHu/PBuYWYH2x2+d+uipDxS4WmvM=
github.com/arduino/go-properties-orderedmap v1.6.0/go.mod h1:DKjD2VXY/NZmlingh4lSFMEYCVubfeArCsGPGDwb2yk=
Expand Down
27 changes: 19 additions & 8 deletions internal/rule/rulefunction/library.go
Original file line number Diff line number Diff line change
Expand Up @@ -1456,17 +1456,28 @@ func LibraryHasStraySketches() (result ruleresult.Type, output string) {
func MissingExamples() (result ruleresult.Type, output string) {
for _, examplesFolderName := range library.ExamplesFolderSupportedNames() {
examplesPath := projectdata.ProjectPath().Join(examplesFolderName)
exists, err := examplesPath.IsDirCheck()

exists, err := examplesPath.ExistCheck()
if err != nil {
panic(err)
}
if exists {
directoryListing, _ := examplesPath.ReadDirRecursive()
directoryListing.FilterDirs()
for _, potentialExamplePath := range directoryListing {
if sketch.ContainsMainSketchFile(potentialExamplePath) {
return ruleresult.Pass, ""
}
if !exists {
continue
}

isDir, err := examplesPath.IsDirCheck()
if err != nil {
panic(err)
}
if !isDir {
continue
}

directoryListing, _ := examplesPath.ReadDirRecursive()
directoryListing.FilterDirs()
for _, potentialExamplePath := range directoryListing {
if sketch.ContainsMainSketchFile(potentialExamplePath) {
return ruleresult.Pass, ""
}
}
}
Expand Down
1 change: 1 addition & 0 deletions internal/rule/rulefunction/library_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,7 @@ func TestLibraryHasStraySketches(t *testing.T) {

func TestMissingExamples(t *testing.T) {
testTables := []libraryRuleFunctionTestTable{
{"File name collision", "ExamplesFile", ruleresult.Fail, ""},
{"Has examples", "ExamplesFolder", ruleresult.Pass, ""},
{`Has examples (in "example" folder)`, "ExampleFolder", ruleresult.Pass, ""},
{"No examples", "NoExamples", ruleresult.Fail, ""},
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name=ExamplesFolder
version=1.0.0
author=Cristian Maglie <c.maglie@example.com>, Pippo Pluto <pippo@example.com>
maintainer=Cristian Maglie <c.maglie@example.com>
sentence=A library that makes coding a web server a breeze.
paragraph=Supports HTTP1.1 and you can do GET and POST.
category=Communication
url=http://example.com/
architectures=avr