Skip to content

Commit

Permalink
Updates lint output to print detail instead of description
Browse files Browse the repository at this point in the history
Signed-off-by: Talon Bowler <[email protected]>
  • Loading branch information
daghack committed Jun 17, 2024
1 parent 5642608 commit 1de23db
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion frontend/dockerfile/dockerfile_lint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions frontend/dockerfile/linter/linter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion frontend/subrequests/lint/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1de23db

Please sign in to comment.