misc_checks: Handle remaining binary files gracefully

This commit is contained in:
Florian Bruhin 2020-09-10 16:40:23 +02:00
parent e3fa34b970
commit abed001aa9
1 changed files with 9 additions and 0 deletions

View File

@ -63,6 +63,15 @@ def _get_files(
if not filename or path.suffix in BINARY_EXTS or is_ignored:
continue
try:
with tokenize.open(str(path)):
pass
except SyntaxError as e:
# Could not find encoding
utils.print_col("{} - maybe {} should be added to BINARY_EXTS?".format(
str(e).capitalize(), path.suffix), 'yellow')
continue
if verbose:
print(path)