Harden diagnostic handling and warning presentation

This commit is contained in:
2026-08-27 18:41:59 +00:00
parent 1025001f20
commit 079d5af337
67 changed files with 518 additions and 318 deletions

View File

@@ -50,18 +50,18 @@ func (v *Validator) Validate(_ context.Context, req contracts.TypedValidationReq
}
citedTexts[index] = citedText
}
warnings := make([]diagnostics.Finding, 0)
findings := make([]diagnostics.Finding, 0)
for index, occurrence := range req.Value.Occurrences {
if shared.ContainsTokenSequence(citedTexts[index], occurrence.Name) {
continue
}
warnings = append(warnings, diagnostics.Finding{
findings = append(findings, diagnostics.Finding{
Scope: fmt.Sprintf("occurrences[%d]", index),
ReasonCode: ReasonCode,
Message: fmt.Sprintf("NPC occurrence name %s was not found in cited source text", diagnostics.Quote(occurrence.Name)),
})
}
return diagnostics.DataQualityResult(warnings)
return diagnostics.DataQualityResult(findings)
}
func Spec() pipeline.ValidatorSpec {