mirror of https://gerrit.osmocom.org/osmo-ci
verify_*.py: Ignore UTF-8 decoding errors
Some of our source files are inherited from other sources, particularly for microcontroller firmware projects. We cannot assume they're all clean UTF-8. Let's ignore any decoder errors when verifying log statements and value_string arrays. Closes: OS#4334 Change-Id: I1e19f4bc6bee46481c6ea743e8334bd4485909be
This commit is contained in:
parent
bcd5a7b927
commit
8d0605c4fb
|
@ -66,7 +66,7 @@ def check_file(f):
|
||||||
try:
|
try:
|
||||||
errors_found = []
|
errors_found = []
|
||||||
|
|
||||||
file_content = codecs.open(f, "r", "utf-8").read()
|
file_content = codecs.open(f, "r", "utf-8", errors='ignore').read()
|
||||||
|
|
||||||
for log in log_statement_re.finditer(file_content):
|
for log in log_statement_re.finditer(file_content):
|
||||||
quoted = log.group(2)
|
quoted = log.group(2)
|
||||||
|
|
|
@ -27,7 +27,7 @@ def check_file(f):
|
||||||
global errors_found
|
global errors_found
|
||||||
if not (f.endswith('.h') or f.endswith('.c') or f.endswith('.cpp')):
|
if not (f.endswith('.h') or f.endswith('.c') or f.endswith('.cpp')):
|
||||||
return
|
return
|
||||||
arrays = value_string_array_re.findall(codecs.open(f, "r", "utf-8").read())
|
arrays = value_string_array_re.findall(codecs.open(f, "r", "utf-8", errors='ignore').read())
|
||||||
for array_def, name in arrays:
|
for array_def, name in arrays:
|
||||||
if not terminator_re.search(array_def):
|
if not terminator_re.search(array_def):
|
||||||
print('ERROR: file contains unterminated value_string %r: %r'
|
print('ERROR: file contains unterminated value_string %r: %r'
|
||||||
|
|
Loading…
Reference in New Issue