Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions pkg/lint/linter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down