checkConfigScopes validates each scope entry has a non-empty paths array.
(config *ConfigData, result *ValidationResult)
| 458 | |
| 459 | // checkConfigScopes validates each scope entry has a non-empty paths array. |
| 460 | func (v *Validator) checkConfigScopes(config *ConfigData, result *ValidationResult) { |
| 461 | for name, scope := range config.Scopes { |
| 462 | label := scopeLabel(name, scope.Description) |
| 463 | if scope.Paths == nil { |
| 464 | result.AddIssue(LevelError, "", config.ConfigPath, |
| 465 | fmt.Sprintf("%s is missing required field: paths", label)) |
| 466 | } else if len(scope.Paths) == 0 { |
| 467 | result.AddIssue(LevelError, "", config.ConfigPath, |
| 468 | fmt.Sprintf("%s has empty paths array", label)) |
| 469 | } |
| 470 | } |
| 471 | } |
| 472 | |
| 473 | // scopeLabel returns a formatted label like "scope 'name' (description)" or "scope 'name'". |
| 474 | func scopeLabel(name, description string) string { |
no test coverage detected