Mercurial > irccd
diff vera/rules/L005.tcl @ 510:6ec510722582
CMake: enable vera++ as code checking, closes #603
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 19 Oct 2017 13:01:39 +0200 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vera/rules/L005.tcl Thu Oct 19 13:01:39 2017 +0200 @@ -0,0 +1,23 @@ +#!/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 + } +}