check-code: add a return value to checkfile function
The checkfile function returns True if the file is correct, False
otherwise.
--- 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__":