# HG changeset patch # User Pierre-Yves David # Date 1268819486 -3600 # Node ID fbcccf9ec58fb448cb3806b31d22379a4dc6fac0 # Parent 3be9ae49b62884ce8a91bae951f1ef55d679a554 check-code: add a return value to checkfile function The checkfile function returns True if the file is correct, False otherwise. diff -r 3be9ae49b628 -r fbcccf9ec58f contrib/check-code.py --- 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__":