mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-04-06 23:30: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> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2158>
This commit is contained in:
parent
a174db79e9
commit
affec12dd2
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