1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/dist/tools/vera++/scripts/rules/L005.tcl
2020-02-14 14:17:16 +01:00

24 lines
654 B
Tcl
Executable File

#!/usr/bin/tclsh
# There should not be too many consecutive empty lines
set maxEmptyLines [getParameter "max-consecutive-empty-lines" 2]
foreach f [getSourceFileNames] {
set lineNumber 1
set emptyCount 0
set reported false
foreach line [getAllLines $f] {
if {[string trim $line] == ""} {
incr emptyCount
if {$emptyCount > $maxEmptyLines && $reported == "false"} {
report $f $lineNumber "too many consecutive empty lines"
set reported true
}
} else {
set emptyCount 0
set reported false
}
incr lineNumber
}
}