Skip to content

Commit 5deda4a

Browse files
authored
Merge pull request moby#5045 from daghack/detail-not-description
Updates lint output to print detail instead of description
2 parents 935713c + 9305c60 commit 5deda4a

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

frontend/dockerfile/linter/linter.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,12 @@ func (rule *LinterRule[F]) Run(warn LintWarnFunc, location []parser.Range, txt .
9191
warn(rule.Name, rule.Description, rule.URL, short, location)
9292
}
9393

94-
func LintFormatShort(rulename, msg string, startLine int) string {
95-
return fmt.Sprintf("%s: %s (line %d)", rulename, msg, startLine)
94+
func LintFormatShort(rulename, msg string, line int) string {
95+
msg = fmt.Sprintf("%s: %s", rulename, msg)
96+
if line > 0 {
97+
msg = fmt.Sprintf("%s (line %d)", msg, line)
98+
}
99+
return msg
96100
}
97101

98102
type LintWarnFunc func(rulename, description, url, fmtmsg string, location []parser.Range)

frontend/subrequests/lint/lint.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ func PrintLintViolations(dt []byte, w io.Writer) error {
173173
if warning.URL != "" {
174174
fmt.Fprintf(w, " - %s", warning.URL)
175175
}
176-
fmt.Fprintf(w, "\n%s\n", warning.Description)
176+
fmt.Fprintf(w, "\n%s\n", warning.Detail)
177177

178178
if warning.Location.SourceIndex < 0 {
179179
continue

0 commit comments

Comments
 (0)