fix(lint): add threshold summary to run failures
Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
e3ae8caae2
commit
10f89a83f2
2 changed files with 12 additions and 1 deletions
|
|
@ -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
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue