MCPcopy Create free account
hub / github.com/catppuccin/cli / lint

Function lint

schema/schema.go:23–41  ·  view source on GitHub ↗
(r io.Reader, loader gojsonschema.JSONLoader)

Source from the content-addressed store, hash-verified

21}
22
23func lint(r io.Reader, loader gojsonschema.JSONLoader) error {
24 data, err := io.ReadAll(r)
25 if err != nil {
26 return err
27 }
28 var m any
29 if err := Unmarshal(data, &m); err != nil {
30 return err
31 }
32 sourceLoader := gojsonschema.NewGoLoader(m)
33 result, err := gojsonschema.Validate(loader, sourceLoader)
34 if err != nil {
35 return err
36 }
37 if len(result.Errors()) > 0 {
38 return ResultErrors(result.Errors())
39 }
40 return nil
41}
42
43// ResultErrors is a slice of gojsonschema.ResultError that implements error
44type ResultErrors []gojsonschema.ResultError

Callers 1

LintFunction · 0.85

Calls 2

UnmarshalFunction · 0.85
ResultErrorsTypeAlias · 0.85

Tested by

no test coverage detected