Merge pull request #5045 from daghack/detail-not-description

Updates lint output to print detail instead of description
This commit is contained in:
CrazyMax
2024-06-18 13:19:01 +02:00
committed by GitHub
2 changed files with 7 additions and 3 deletions

View File

@@ -91,8 +91,12 @@ 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, line int) string {
msg = fmt.Sprintf("%s: %s", rulename, msg)
if line > 0 {
msg = fmt.Sprintf("%s (line %d)", msg, line)
}
return msg
}
type LintWarnFunc func(rulename, description, url, fmtmsg string, location []parser.Range)

View File

@@ -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