From 7c9f3caacb1a591f01ba0603a815644f200005a8 Mon Sep 17 00:00:00 2001 From: p4u1 Date: Tue, 15 Apr 2025 20:23:23 +0200 Subject: [PATCH] fix(lint): Improves error message if a lint rule errors This was detected while debugging https://git.coopcloud.tech/toolshed/abra/issues/534 --- pkg/lint/recipe.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/lint/recipe.go b/pkg/lint/recipe.go index 1462fa83..4f7f5e24 100644 --- a/pkg/lint/recipe.go +++ b/pkg/lint/recipe.go @@ -15,8 +15,10 @@ import ( "github.com/go-git/go-git/v5/plumbing" ) -var Warn = "warn" -var Critical = "critical" +var ( + Warn = "warn" + Critical = "critical" +) type LintFunction func(recipe.Recipe) (bool, error) @@ -194,7 +196,7 @@ func LintForErrors(recipe recipe.Recipe) error { ok, err := rule.Function(recipe) if err != nil { - return err + return fmt.Errorf("lint %s: %s", rule.Ref, err) } if !ok { return fmt.Errorf("lint error in %s configs: \"%s\" failed lint checks (%s)", recipe.Name, rule.Description, rule.Ref) -- 2.47.2