fix(lint): add threshold summary to run failures

Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
Virgil 2026-04-01 12:39:22 +00:00
parent e3ae8caae2
commit 10f89a83f2
2 changed files with 12 additions and 1 deletions

View file

@ -96,7 +96,17 @@ func newRunCommand(commandName string, summary string, defaults lintpkg.RunInput
return err
}
if !report.Summary.Passed {
return coreerr.E("cmd."+commandName, "lint failed", nil)
return coreerr.E(
"cmd."+commandName,
fmt.Sprintf(
"lint failed (fail-on=%s): %d error(s), %d warning(s), %d info finding(s)",
input.FailOn,
report.Summary.Errors,
report.Summary.Warnings,
report.Summary.Info,
),
nil,
)
}
return nil
})

View file

@ -40,6 +40,7 @@ func Run() {
stdout, stderr, exitCode := runCLI(t, dir, "run", "--output", "json", "--fail-on", "warning", dir)
assert.Equal(t, 1, exitCode, stderr)
assert.Contains(t, stderr, "lint failed (fail-on=warning)")
var report lintpkg.Report
require.NoError(t, json.Unmarshal([]byte(stdout), &report))