Skip to content

Commit abd360f

Browse files
committed
Split check functions into separate files according to project type
1 parent 132ce6d commit abd360f

File tree

2 files changed

+48
-43
lines changed

2 files changed

+48
-43
lines changed
-43
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,8 @@
11
package checkfunctions
22

33
import (
4-
"github.com/arduino/arduino-check/check/checkdata"
54
"github.com/arduino/arduino-check/check/checkresult"
6-
"github.com/arduino/arduino-check/project/library/libraryproperties"
75
)
86

97
// output is the contextual information that will be added to the stock message
108
type Type func() (result checkresult.Type, output string)
11-
12-
func LibraryPropertiesFormat() (result checkresult.Type, output string) {
13-
if checkdata.LibraryPropertiesLoadError() != nil {
14-
return checkresult.Fail, checkdata.LibraryPropertiesLoadError().Error()
15-
}
16-
return checkresult.Pass, ""
17-
}
18-
19-
func LibraryPropertiesNameFieldMissing() (result checkresult.Type, output string) {
20-
if checkdata.LibraryPropertiesLoadError() != nil {
21-
return checkresult.NotRun, ""
22-
}
23-
24-
if libraryproperties.FieldMissing("name", checkdata.LibraryPropertiesSchemaValidationResult()) {
25-
return checkresult.Fail, ""
26-
}
27-
return checkresult.Pass, ""
28-
}
29-
30-
func LibraryPropertiesNameFieldDisallowedCharacters() (result checkresult.Type, output string) {
31-
if checkdata.LibraryPropertiesLoadError() != nil {
32-
return checkresult.NotRun, ""
33-
}
34-
35-
if libraryproperties.FieldPatternMismatch("name", checkdata.LibraryPropertiesSchemaValidationResult()) {
36-
return checkresult.Fail, ""
37-
}
38-
39-
return checkresult.Pass, ""
40-
}
41-
42-
func LibraryPropertiesVersionFieldMissing() (result checkresult.Type, output string) {
43-
if checkdata.LibraryPropertiesLoadError() != nil {
44-
return checkresult.NotRun, ""
45-
}
46-
47-
if libraryproperties.FieldMissing("version", checkdata.LibraryPropertiesSchemaValidationResult()) {
48-
return checkresult.Fail, ""
49-
}
50-
return checkresult.Pass, ""
51-
}

check/checkfunctions/library.go

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package checkfunctions
2+
3+
import (
4+
"github.com/arduino/arduino-check/check/checkdata"
5+
"github.com/arduino/arduino-check/check/checkresult"
6+
"github.com/arduino/arduino-check/project/library/libraryproperties"
7+
)
8+
9+
func LibraryPropertiesFormat() (result checkresult.Type, output string) {
10+
if checkdata.LibraryPropertiesLoadError() != nil {
11+
return checkresult.Fail, checkdata.LibraryPropertiesLoadError().Error()
12+
}
13+
return checkresult.Pass, ""
14+
}
15+
16+
func LibraryPropertiesNameFieldMissing() (result checkresult.Type, output string) {
17+
if checkdata.LibraryPropertiesLoadError() != nil {
18+
return checkresult.NotRun, ""
19+
}
20+
21+
if libraryproperties.FieldMissing("name", checkdata.LibraryPropertiesSchemaValidationResult()) {
22+
return checkresult.Fail, ""
23+
}
24+
return checkresult.Pass, ""
25+
}
26+
27+
func LibraryPropertiesNameFieldDisallowedCharacters() (result checkresult.Type, output string) {
28+
if checkdata.LibraryPropertiesLoadError() != nil {
29+
return checkresult.NotRun, ""
30+
}
31+
32+
if libraryproperties.FieldPatternMismatch("name", checkdata.LibraryPropertiesSchemaValidationResult()) {
33+
return checkresult.Fail, ""
34+
}
35+
36+
return checkresult.Pass, ""
37+
}
38+
39+
func LibraryPropertiesVersionFieldMissing() (result checkresult.Type, output string) {
40+
if checkdata.LibraryPropertiesLoadError() != nil {
41+
return checkresult.NotRun, ""
42+
}
43+
44+
if libraryproperties.FieldMissing("version", checkdata.LibraryPropertiesSchemaValidationResult()) {
45+
return checkresult.Fail, ""
46+
}
47+
return checkresult.Pass, ""
48+
}

0 commit comments

Comments
 (0)