2018-08-14 14:47:19 +02:00
|
|
|
#!/usr/bin/tclsh
|
|
|
|
# Line cannot be too long
|
|
|
|
|
|
|
|
set maxLength [getParameter "max-line-length" 100]
|
|
|
|
|
2021-01-06 11:37:33 +01:00
|
|
|
#MOD: We add here a line length thershold for line length
|
|
|
|
set maxLengthWarn [getParameter "max-line-length-warn" 80]
|
|
|
|
|
2018-08-14 14:47:19 +02:00
|
|
|
foreach f [getSourceFileNames] {
|
|
|
|
set lineNumber 1
|
|
|
|
foreach line [getAllLines $f] {
|
|
|
|
if {[string length $line] > $maxLength} {
|
|
|
|
report $f $lineNumber "line is longer than ${maxLength} characters"
|
2021-01-06 11:37:33 +01:00
|
|
|
} elseif {[string length $line] > $maxLengthWarn} {
|
|
|
|
# puts won't make vera++ return error code when invoked with --error
|
|
|
|
puts "$f:$lineNumber: warning: line is longer than $maxLengthWarn characters"
|
2018-08-14 14:47:19 +02:00
|
|
|
}
|
|
|
|
incr lineNumber
|
|
|
|
}
|
|
|
|
}
|