mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-03-31 04:10:41 +02:00
CI: Catch UnicodeDecodeError in whitespace-check.py
Changes behavior when a non-UTF-8 character is found from exiting the script with a Python exception traceback and no clue which file had it to reporting the filename and continuing to check the remaining files. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
This commit is contained in:
parent
16ca2c7a11
commit
cd6edf4131
1 changed files with 7 additions and 1 deletions
|
|
@ -94,7 +94,13 @@ def main():
|
|||
reset = ""
|
||||
|
||||
for file in args.files:
|
||||
lines = [l.rstrip("\n") for l in file.open().readlines()]
|
||||
try:
|
||||
lines = [l.rstrip("\n") for l in file.open().readlines()]
|
||||
except UnicodeDecodeError as e:
|
||||
print(f"{red}ERROR: {e} in {file}:{reset}", file=sys.stderr)
|
||||
print(f"{'-' * 72}", file=sys.stderr)
|
||||
have_errors = True
|
||||
continue
|
||||
|
||||
errors = []
|
||||
errors.extend(test_tab_indent(lines))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue