|
@@ -257,18 +257,23 @@ def check_file_using_lib(fname):
|
|
nwarnings += warn
|
|
nwarnings += warn
|
|
|
|
|
|
lastline = ""
|
|
lastline = ""
|
|
- 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
|
|
|
|
|
|
+ try:
|
|
|
|
+ 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
|
|
|
|
+ except FileNotFoundError:
|
|
|
|
+ print(f"{fname}: missing; unstaged file removal?")
|
|
|
|
+ nwarnings += 1
|
|
|
|
+ return nwarnings, nlines
|
|
|
|
|
|
for name, cf in objects:
|
|
for name, cf in objects:
|
|
warn, fail = print_warnings(cf.after(), name in xfail)
|
|
warn, fail = print_warnings(cf.after(), name in xfail)
|