changeset 10720:fbcccf9ec58f

check-code: add a return value to checkfile function The checkfile function returns True if the file is correct, False otherwise.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Wed, 17 Mar 2010 10:51:26 +0100
parents 3be9ae49b628
children 67ba66070aee
files contrib/check-code.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/check-code.py	Tue Mar 16 19:53:00 2010 +0100
+++ b/contrib/check-code.py	Wed Mar 17 10:51:26 2010 +0100
@@ -166,7 +166,10 @@
               logfunc(filename, linenumber, linecontent, errormessage)
     :maxerr: number of error to display before arborting.
              Set to None (default) to report all errors
+
+    return True if no error is found, False otherwise.
     """
+    result = True
     for name, match, filters, pats in checks:
         fc = 0
         if not re.match(match, f):
@@ -185,10 +188,12 @@
                 if re.search(p, l[1]):
                     logfunc(f, n+1, l[0], msg)
                     fc += 1
+                    result = False
             if maxerr is not None and fc >= maxerr:
                 print " (too many errors, giving up)"
                 break
         break
+    return result
 
 
 if __name__ == "__main__":