From 1de23db26f530312bd3c020e88ecfcd858b424c4 Mon Sep 17 00:00:00 2001 From: Talon Bowler Date: Mon, 17 Jun 2024 07:07:16 -0700 Subject: [PATCH] Updates lint output to print detail instead of description Signed-off-by: Talon Bowler --- frontend/dockerfile/dockerfile_lint_test.go | 2 +- frontend/dockerfile/linter/linter.go | 4 ++-- frontend/subrequests/lint/lint.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/dockerfile/dockerfile_lint_test.go b/frontend/dockerfile/dockerfile_lint_test.go index 9a1eb1ec397c2..40c9624330390 100644 --- a/frontend/dockerfile/dockerfile_lint_test.go +++ b/frontend/dockerfile/dockerfile_lint_test.go @@ -1088,7 +1088,7 @@ func checkLinterWarnings(t *testing.T, sb integration.Sandbox, lintTest *lintTes func checkVertexWarning(t *testing.T, warning *client.VertexWarning, expected expectedLintWarning) { t.Helper() - short := linter.LintFormatShort(expected.RuleName, expected.Detail, expected.Line) + short := linter.LintFormatShort(expected.RuleName, expected.Detail) require.Equal(t, short, string(warning.Short)) require.Equal(t, expected.Description, string(warning.Detail[0])) require.Equal(t, expected.URL, warning.URL) diff --git a/frontend/dockerfile/linter/linter.go b/frontend/dockerfile/linter/linter.go index bb33a14229b3e..ea8c2f03f8bb2 100644 --- a/frontend/dockerfile/linter/linter.go +++ b/frontend/dockerfile/linter/linter.go @@ -91,8 +91,8 @@ func (rule *LinterRule[F]) Run(warn LintWarnFunc, location []parser.Range, txt . warn(rule.Name, rule.Description, rule.URL, short, location) } -func LintFormatShort(rulename, msg string, startLine int) string { - return fmt.Sprintf("%s: %s (line %d)", rulename, msg, startLine) +func LintFormatShort(rulename, msg string) string { + return fmt.Sprintf("%s: %s", rulename, msg) } type LintWarnFunc func(rulename, description, url, fmtmsg string, location []parser.Range) diff --git a/frontend/subrequests/lint/lint.go b/frontend/subrequests/lint/lint.go index 402a704b9550c..46d93a00dd06f 100644 --- a/frontend/subrequests/lint/lint.go +++ b/frontend/subrequests/lint/lint.go @@ -173,7 +173,7 @@ func PrintLintViolations(dt []byte, w io.Writer) error { if warning.URL != "" { fmt.Fprintf(w, " - %s", warning.URL) } - fmt.Fprintf(w, "\n%s\n", warning.Description) + fmt.Fprintf(w, "\n%s\n", warning.Detail) if warning.Location.SourceIndex < 0 { continue