Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check_encoding.py CI fix #133

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions tools/check_encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@
if suffix in SUFFICES:
with open(os.path.join(root, file)) as f:
contents = f.read()
try:
contents.decode('ascii')
except UnicodeDecodeError:
if not contents.isascii():
for line in contents.split('\n'):
try:
line.decode('ascii')
except UnicodeDecodeError:
raise Exception('Detected non-ascii characters in file {}, line: "{}"'.format(os.path.join(root, file), line))
if not line.isascii():
raise Exception('Detected non-ascii characters in file {}, line: "{}"'.format(os.path.join(root, file), line))
grantfirl marked this conversation as resolved.
Show resolved Hide resolved
Loading