MCPcopy Index your code
hub / github.com/jetify-com/devbox / validateScripts

Function validateScripts

internal/devconfig/configfile/file.go:180–196  ·  view source on GitHub ↗
(cfg *ConfigFile)

Source from the content-addressed store, hash-verified

178var whitespace = regexp.MustCompile(`\s`)
179
180func validateScripts(cfg *ConfigFile) error {
181 scripts := cfg.Scripts()
182 for k := range scripts {
183 if strings.TrimSpace(k) == "" {
184 return errors.New("cannot have script with empty name in devbox.json")
185 }
186 if whitespace.MatchString(k) {
187 return errors.Errorf(
188 "cannot have script name with whitespace in devbox.json: %s", k)
189 }
190 if strings.TrimSpace(scripts[k].String()) == "" {
191 return errors.Errorf(
192 "cannot have an empty script body in devbox.json: %s", k)
193 }
194 }
195 return nil
196}
197
198func validateAliases(cfg *ConfigFile) error {
199 for name, command := range cfg.Aliases {

Callers

nothing calls this directly

Calls 2

ScriptsMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected