Skip to content

Commit

Permalink
Adds 'WARNING' prefix to the rule check output and update lint
Browse files Browse the repository at this point in the history
subrequest to return a status of 1 if an error occurred

Signed-off-by: Talon Bowler <talon.bowler@docker.com>
(cherry picked from commit 09dafda)
  • Loading branch information
daghack authored and tonistiigi committed Jun 18, 2024
1 parent 05bd56b commit 49dd5f4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions frontend/subrequests/lint/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func (results *LintResults) ToResult() (*client.Result, error) {
res.AddMeta("result.txt", b.Bytes())

status := 0
if len(results.Warnings) > 0 {
if len(results.Warnings) > 0 || results.Error != nil {
status = 1
}
res.AddMeta("result.statuscode", []byte(fmt.Sprintf("%d", status)))
Expand Down Expand Up @@ -169,7 +169,7 @@ func PrintLintViolations(dt []byte, w io.Writer) error {
})

for _, warning := range results.Warnings {
fmt.Fprintf(w, "%s", warning.RuleName)
fmt.Fprintf(w, "\nWARNING: %s", warning.RuleName)
if warning.URL != "" {
fmt.Fprintf(w, " - %s", warning.URL)
}
Expand All @@ -187,8 +187,8 @@ func PrintLintViolations(dt []byte, w io.Writer) error {
if err != nil {
return err
}
fmt.Fprintln(w)
}

return nil
}

Expand Down

0 comments on commit 49dd5f4

Please sign in to comment.