fix(lint): Improves error message if a lint rule errors
All checks were successful
continuous-integration/drone/push Build is passing

This was detected while debugging #534
This commit is contained in:
p4u1 2025-04-15 20:23:23 +02:00 committed by decentral1se
parent 895a7fe7d6
commit fa084a61d2

View File

@ -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)