Skip to content

Commit 164918b

Browse files
committed
dist/tools/vera++: allow comments to be overlong
The line length check is very noisy, especially in the Github web view with annotations added to every overlong line. Reducing the number of false positives there for is very valuable. In comments, we often have overlong lines e.g. because an URL is longer than 100 chars, because we add a larger markdown table, we add ASCII art to visualize data structures, or because we add dot syntax that may just need overlong lines. Since vera++ does not support annotations with magic comments to disable the length check just for a table / URL / graphic, this just disables the length checks for all comments outright.
1 parent 216ef04 commit 164918b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

dist/tools/vera++/scripts/rules/L004.tcl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ foreach f [getSourceFileNames] {
77
set lineNumber 1
88
foreach line [getAllLines $f] {
99
if {[string length $line] > $maxLength} {
10-
report $f $lineNumber "line is longer than ${maxLength} characters"
10+
# ignore overlong line if it appears to be within a comment
11+
if {!([string match " \* *" $line] || [string match "// *" $line])} {
12+
report $f $lineNumber "line is longer than ${maxLength} characters"
13+
}
1114
}
1215
incr lineNumber
1316
}

0 commit comments

Comments
 (0)