|
@@ -233,16 +233,18 @@ def check_file_using_lib(fname):
|
|
|
nwarnings += warn
|
|
|
|
|
|
lastline = ""
|
|
|
- for lineno, text in enumerate(open(fname, "r", errors="surrogateescape").readlines()):
|
|
|
- nlines += 1
|
|
|
- for name, cf in objects:
|
|
|
- if cf.disable.search(lastline):
|
|
|
- continue
|
|
|
- warn, fail = print_warnings(cf.check_line(lineno + 1, text), name in xfail)
|
|
|
- if fail > 0:
|
|
|
- failed.add(name)
|
|
|
- nwarnings += warn
|
|
|
- lastline = text
|
|
|
+ with open(fname, "r", errors="surrogateescape") as f:
|
|
|
+ for lineno, text in enumerate(f):
|
|
|
+ nlines += 1
|
|
|
+ for name, cf in objects:
|
|
|
+ if cf.disable.search(lastline):
|
|
|
+ continue
|
|
|
+ line_sts = cf.check_line(lineno + 1, text)
|
|
|
+ warn, fail = print_warnings(line_sts, name in xfail)
|
|
|
+ if fail > 0:
|
|
|
+ failed.add(name)
|
|
|
+ nwarnings += warn
|
|
|
+ lastline = text
|
|
|
|
|
|
for name, cf in objects:
|
|
|
warn, fail = print_warnings(cf.after(), name in xfail)
|