aboutsummaryrefslogtreecommitdiff
path: root/internal/validate/validate.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-18 20:11:29 -0400
committerhistoria <[not public]>2026-09-18 20:11:29 -0400
commit0f812ccc307ea0550511ccced40b65dfb0cdaa91 (patch)
tree7f2f343985275a478ba7295a37fcd48871ca4956 /internal/validate/validate.go
parent79764732406d6484f67d3dec045483dcb5d08c28 (diff)
downloadthehouseoficarus-0f812ccc307ea0550511ccced40b65dfb0cdaa91.tar.gz
fix: world and casino integrity fixes
Diffstat (limited to 'internal/validate/validate.go')
-rw-r--r--internal/validate/validate.go20
1 files changed, 16 insertions, 4 deletions
diff --git a/internal/validate/validate.go b/internal/validate/validate.go
index d77eafa..a7ce1b0 100644
--- a/internal/validate/validate.go
+++ b/internal/validate/validate.go
@@ -126,7 +126,7 @@ func Run(s Source) []Issue {
func validateRoomFilenames(dataDir string) []Issue {
dir := filepath.Join(dataDir, "rooms")
var issues []Issue
- _ = behavior.WalkYAMLDir(dir, func(path, id string, data []byte) error {
+ if err := behavior.WalkYAMLDir(dir, func(path, id string, data []byte) error {
if _, err := strconv.Atoi(id); err != nil {
rel := strings.TrimPrefix(path, dataDir+"/")
issues = append(issues, Issue{
@@ -136,7 +136,13 @@ func validateRoomFilenames(dataDir string) []Issue {
})
}
return nil
- })
+ }); err != nil {
+ issues = append(issues, Issue{
+ Level: "ERROR",
+ Type: "integrity",
+ Message: fmt.Sprintf("rooms: could not scan room files: %v", err),
+ })
+ }
return issues
}
@@ -159,7 +165,7 @@ func validateKnownFields(dataDir string, extra []KnownFieldTarget) []Issue {
var issues []Issue
for _, t := range targets {
dir := filepath.Join(dataDir, t.SubDir)
- _ = behavior.WalkYAMLDir(dir, func(path, id string, data []byte) error {
+ if err := behavior.WalkYAMLDir(dir, func(path, id string, data []byte) error {
dec := yaml.NewDecoder(bytes.NewReader(data))
dec.KnownFields(true)
if err := dec.Decode(t.NewDef()); err != nil {
@@ -171,7 +177,13 @@ func validateKnownFields(dataDir string, extra []KnownFieldTarget) []Issue {
})
}
return nil
- })
+ }); err != nil {
+ issues = append(issues, Issue{
+ Level: "ERROR",
+ Type: "unknown-field",
+ Message: fmt.Sprintf("%s: could not scan %s: %v", t.Label, t.SubDir, err),
+ })
+ }
}
// cards.yaml lives at the data root rather than a subdirectory.
if data, err := os.ReadFile(filepath.Join(dataDir, "cards.yaml")); err == nil {