changeset 10718:f18c37fd624f

check-code: Add a ``maxerr`` argument to the ``checkfile`` function check-code.py used to halt after 15 errors. This changeset adds a new argument to the checkfile function to control this limit.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Tue, 16 Mar 2010 19:52:58 +0100
parents b1f4fcef99b3
children 3be9ae49b628
files contrib/check-code.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/check-code.py	Tue Mar 16 19:52:57 2010 +0100
+++ b/contrib/check-code.py	Tue Mar 16 19:52:58 2010 +0100
@@ -133,7 +133,7 @@
     ('test script', r'(.*/)?test-[^.~]*$', testfilters, testpats),
     ('c', r'.*\.c$', cfilters, cpats),
 ]
-def checkfile(f):
+def checkfile(f, maxerr=None):
     """checks style and portability of a given file"""
     for name, match, filters, pats in checks:
         fc = 0
@@ -158,7 +158,7 @@
                     print " %s" % msg
                     lc += 1
                     fc += 1
-            if fc == 15:
+            if maxerr is not None and fc >= maxerr:
                 print " (too many errors, giving up)"
                 break
         break
@@ -171,4 +171,4 @@
         check = sys.argv[1:]
 
     for f in check:
-        checkfile(f)
+        checkfile(f, maxerr=15)