MCPcopy Create free account
hub / github.com/driangle/taskmd / checkIDConfig

Method checkIDConfig

sdk/go/validator/validator.go:388–413  ·  view source on GitHub ↗

checkIDConfig validates the id config section.

(config *ConfigData, result *ValidationResult)

Source from the content-addressed store, hash-verified

386
387// checkIDConfig validates the id config section.
388func (v *Validator) checkIDConfig(config *ConfigData, result *ValidationResult) {
389 if config.ID == nil {
390 return
391 }
392 id := config.ID
393
394 if id.Strategy != "" && !validIDStrategies[id.Strategy] {
395 result.AddIssue(LevelError, "", config.ConfigPath,
396 fmt.Sprintf("invalid id strategy: '%s' (valid values: sequential, prefixed, random, ulid)", id.Strategy))
397 }
398
399 if id.Strategy == "prefixed" && id.Prefix == "" {
400 result.AddIssue(LevelError, "", config.ConfigPath,
401 "id strategy 'prefixed' requires a non-empty prefix")
402 }
403
404 if id.Length < 0 {
405 result.AddIssue(LevelError, "", config.ConfigPath,
406 fmt.Sprintf("id length must not be negative, got %d", id.Length))
407 }
408
409 if id.Padding < 0 {
410 result.AddIssue(LevelError, "", config.ConfigPath,
411 fmt.Sprintf("id padding must not be negative, got %d", id.Padding))
412 }
413}
414
415// checkPhaseConfig validates phase entries for structural issues and duplicates.
416func (v *Validator) checkPhaseConfig(config *ConfigData, result *ValidationResult) {

Callers 1

ValidateConfigMethod · 0.95

Calls 1

AddIssueMethod · 0.80

Tested by

no test coverage detected