forked from toolshed/abra
fix(lint): Improves error message if a lint rule errors
This was detected while debugging toolshed/abra#534
This commit is contained in:
parent
895a7fe7d6
commit
fa084a61d2
@ -15,8 +15,10 @@ import (
|
|||||||
"github.com/go-git/go-git/v5/plumbing"
|
"github.com/go-git/go-git/v5/plumbing"
|
||||||
)
|
)
|
||||||
|
|
||||||
var Warn = "warn"
|
var (
|
||||||
var Critical = "critical"
|
Warn = "warn"
|
||||||
|
Critical = "critical"
|
||||||
|
)
|
||||||
|
|
||||||
type LintFunction func(recipe.Recipe) (bool, error)
|
type LintFunction func(recipe.Recipe) (bool, error)
|
||||||
|
|
||||||
@ -194,7 +196,7 @@ func LintForErrors(recipe recipe.Recipe) error {
|
|||||||
|
|
||||||
ok, err := rule.Function(recipe)
|
ok, err := rule.Function(recipe)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("lint %s: %s", rule.Ref, err)
|
||||||
}
|
}
|
||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("lint error in %s configs: \"%s\" failed lint checks (%s)", recipe.Name, rule.Description, rule.Ref)
|
return fmt.Errorf("lint error in %s configs: \"%s\" failed lint checks (%s)", recipe.Name, rule.Description, rule.Ref)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user