view vera/rules/L005.tcl @ 708:0dd4fb9dfcc8

Irccd: disable pid, gid, uid and daemon options, closes #846 @1h Those options are too platform specific and should be handled by the service manager instead.
author David Demelier <markand@malikania.fr>
date Sat, 07 Jul 2018 09:21:10 +0200
parents 6ec510722582
children
line wrap: on
line source

#!/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
    }
}