MCPcopy
hub / github.com/wtfutil/wtf / validate

Function validate

app/module_validator.go:43–59  ·  view source on GitHub ↗
(widgets []wtf.Wtfable)

Source from the content-addressed store, hash-verified

41}
42
43func validate(widgets []wtf.Wtfable) (widgetErrors []widgetError) {
44 for _, widget := range widgets {
45 err := widgetError{name: widget.Name()}
46
47 for _, val := range widget.CommonSettings().Validations() {
48 if val.HasError() {
49 err.validationErrors = append(err.validationErrors, val)
50 }
51 }
52
53 if len(err.validationErrors) > 0 {
54 widgetErrors = append(widgetErrors, err)
55 }
56 }
57
58 return widgetErrors
59}
60
61func (err widgetError) errorMessages() (messages []string) {
62 widgetMessage := fmt.Sprintf(

Callers 2

ValidateMethod · 0.85
Test_validateFunction · 0.85

Calls 4

ValidationsMethod · 0.80
NameMethod · 0.65
CommonSettingsMethod · 0.65
HasErrorMethod · 0.65

Tested by 1

Test_validateFunction · 0.68