Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Commit

Permalink
Fixed miessage_substitutions in missing_header (#340)
Browse files Browse the repository at this point in the history
* Fixed miessage_substitutions im missing_header

* Improved an error message

* Fixed linting
  • Loading branch information
roll committed Mar 18, 2020
1 parent ff0ac49 commit 474122d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions goodtables/checks/missing_header.py
Expand Up @@ -22,12 +22,17 @@ def missing_header(cells, sample):
continue

# Add error
message_substitutions = {
'field_name': '"{}"'.format(cell['field'].name),
}
field_name = cell['field'].name if cell['field'] else ''
message_substitutions = {'field_name': '"{}"'.format(field_name)}
message = 'There is a missing header in column {column_number}'
# It's a temporary solution for
# https://github.com/frictionlessdata/goodtables-py/issues/338
if not cell.get('column-number'):
message = 'There is a missing header in column {field_name}'
error = Error(
'missing-header',
cell,
message=message,
message_substitutions=message_substitutions
)
errors.append(error)
Expand Down

0 comments on commit 474122d

Please sign in to comment.