ValidatePhasesAgainstConfig warns when tasks reference phases not defined in config. Skips validation if knownPhases is nil or empty.
(tasks []*model.Task, knownPhases map[string]bool)
| 540 | // ValidatePhasesAgainstConfig warns when tasks reference phases not defined in config. |
| 541 | // Skips validation if knownPhases is nil or empty. |
| 542 | func (v *Validator) ValidatePhasesAgainstConfig(tasks []*model.Task, knownPhases map[string]bool) *ValidationResult { |
| 543 | result := &ValidationResult{ |
| 544 | Issues: make([]ValidationIssue, 0), |
| 545 | } |
| 546 | if len(knownPhases) == 0 { |
| 547 | return result |
| 548 | } |
| 549 | |
| 550 | reported := make(map[string]bool) |
| 551 | for _, task := range tasks { |
| 552 | if task.Phase == "" { |
| 553 | continue |
| 554 | } |
| 555 | if !knownPhases[task.Phase] && !reported[task.Phase] { |
| 556 | reported[task.Phase] = true |
| 557 | result.AddIssue(LevelWarning, task.ID, task.FilePath, |
| 558 | fmt.Sprintf("phase references undefined phase: '%s'. Add it to the phases list in .taskmd.yaml", task.Phase)) |
| 559 | } |
| 560 | } |
| 561 | |
| 562 | return result |
| 563 | } |
| 564 | |
| 565 | // checkStrictWarnings performs additional checks in strict mode |
| 566 | func (v *Validator) checkStrictWarnings(tasks []*model.Task, result *ValidationResult) { |