Commit 5746d6f3 authored by Pierre Dittgen's avatar Pierre Dittgen
Browse files

Keep only one value error for a cell

parent 299e4176
......@@ -141,6 +141,19 @@ def amend_report(report):
if any([err['tag'] == 'structure' and err['code'] != 'invalid-column-delimiter' for err in errors]):
errors = [err for err in errors if err['tag'] != 'value']
# Among value errors, only keep a single error by error cell
# => the 1st encountered one
filtered_errors = []
row_col_set = set()
for err in errors:
if err['tag'] == 'value':
row_col_id = '{}_{}'.format(err['row-number'], err['column-number'])
if row_col_id in row_col_set:
continue
row_col_set.add(row_col_id)
filtered_errors.append(err)
errors = filtered_errors
# Integrate enhanced errors into report
report['tables'][0]['errors'] = errors
report['tables'][0]['error-count'] = len(errors)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment