diff --git a/pkg/lint/linter.go b/pkg/lint/linter.go index 7ce6d6f43..eb8fec6f9 100644 --- a/pkg/lint/linter.go +++ b/pkg/lint/linter.go @@ -111,16 +111,22 @@ func (l *Linter) Lint(ctx context.Context, minSeverity Severity) (Result, error) // Print prints the result to stdout. func (l *Linter) Print(ctx context.Context, result Result) { log := clog.FromContext(ctx) - foundAny := false + if !result.HasErrors() { + log.Infof("No linting issues found!") + return + } for _, res := range result { - if res.Errors.WrapErrors() != nil { - foundAny = true - log.Infof("Package: %s: %s", res.File, res.Errors.WrapErrors()) + for _, v := range res.Errors { + switch v.Rule.Severity.Value { + case SeverityErrorLevel: + log.Errorf("Package: %s: %s", res.File, v.Error) + case SeverityWarningLevel: + log.Warnf("Package: %s: %s", res.File, v.Error) + case SeverityInfoLevel: + log.Infof("Package: %s: %s", res.File, v.Error) + } } } - if !foundAny { - log.Infof("No linting issues found!") - } } // PrintRules prints the rules to stdout.