##// END OF EJS Templates
check-code: add a return value to checkfile function...
Pierre-Yves David -
r10720:fbcccf9e default
parent child Browse files
Show More
@@ -166,7 +166,10 b' def checkfile(f, logfunc=_defaultlogger.'
166 logfunc(filename, linenumber, linecontent, errormessage)
166 logfunc(filename, linenumber, linecontent, errormessage)
167 :maxerr: number of error to display before arborting.
167 :maxerr: number of error to display before arborting.
168 Set to None (default) to report all errors
168 Set to None (default) to report all errors
169
170 return True if no error is found, False otherwise.
169 """
171 """
172 result = True
170 for name, match, filters, pats in checks:
173 for name, match, filters, pats in checks:
171 fc = 0
174 fc = 0
172 if not re.match(match, f):
175 if not re.match(match, f):
@@ -185,10 +188,12 b' def checkfile(f, logfunc=_defaultlogger.'
185 if re.search(p, l[1]):
188 if re.search(p, l[1]):
186 logfunc(f, n+1, l[0], msg)
189 logfunc(f, n+1, l[0], msg)
187 fc += 1
190 fc += 1
191 result = False
188 if maxerr is not None and fc >= maxerr:
192 if maxerr is not None and fc >= maxerr:
189 print " (too many errors, giving up)"
193 print " (too many errors, giving up)"
190 break
194 break
191 break
195 break
196 return result
192
197
193
198
194 if __name__ == "__main__":
199 if __name__ == "__main__":
General Comments 0
You need to be logged in to leave comments. Login now