Skip to content

Commit 3da4cef

Browse files
committed
internal/report: fix max line length handling
The intent is that a single-word line greater than 100 characters is allowed. The code was checking the entire content, not just the current line. Also display the line in the error. Change-Id: I8ad83d25c905e0a7ff13612cfe829df540897fb8 Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/494936 Run-TryBot: Jonathan Amsterdam <[email protected]> Reviewed-by: Tatiana Bradley <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent 9656646 commit 3da4cef

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

internal/report/lint.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,10 @@ func (r *Report) lintLineLength(field, content string, addIssue func(string)) {
210210
if len(line) <= maxLineLength {
211211
continue
212212
}
213-
if !strings.Contains(content, " ") {
213+
if !strings.Contains(line, " ") {
214214
continue // A single long word is OK.
215215
}
216-
addIssue(fmt.Sprintf("%v contains line > %v characters long", field, maxLineLength))
216+
addIssue(fmt.Sprintf("%v contains line > %v characters long: %q", field, maxLineLength, line))
217217
return
218218
}
219219
}

0 commit comments

Comments
 (0)