diff vera/rules/L004.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/L004.tcl	Thu Oct 19 13:01:39 2017 +0200
@@ -0,0 +1,14 @@
+#!/usr/bin/tclsh
+# Line cannot be too long
+
+set maxLength [getParameter "max-line-length" 100]
+
+foreach f [getSourceFileNames] {
+    set lineNumber 1
+    foreach line [getAllLines $f] {
+        if {[string length $line] > $maxLength} {
+            report $f $lineNumber "line is longer than ${maxLength} characters"
+        }
+        incr lineNumber
+    }
+}