Skip to content

Commit

Permalink
Add extra type for manifest validation (#3662)
Browse files Browse the repository at this point in the history
  • Loading branch information
nmuesch authored Apr 22, 2019
1 parent 176b71d commit c670d32
Showing 1 changed file with 4 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -314,36 +314,16 @@ def manifest(fix, include_extras):
display_queue.append((echo_failure, ' required non-null sequence: categories'))

# type
correct_integration_type = 'check'
correct_integration_types = ['check', 'crawler']
integration_type = decoded.get('type')
if not integration_type or not isinstance(integration_type, string_types):
file_failures += 1
output = ' required non-null string: type'

if fix:
decoded['type'] = correct_integration_type

display_queue.append((echo_warning, output))
display_queue.append((echo_success, ' new `type`: {}'.format(correct_integration_type)))

file_failures -= 1
file_fixed = True
else:
display_queue.append((echo_failure, output))
elif integration_type != correct_integration_type:
display_queue.append((echo_failure, output))
elif integration_type not in correct_integration_types:
file_failures += 1
output = ' invalid `type`: {}'.format(integration_type)

if fix:
decoded['type'] = correct_integration_type

display_queue.append((echo_warning, output))
display_queue.append((echo_success, ' new `type`: {}'.format(correct_integration_type)))

file_failures -= 1
file_fixed = True
else:
display_queue.append((echo_failure, output))
display_queue.append((echo_failure, output))

# is_public
correct_is_public = True
Expand Down

0 comments on commit c670d32

Please sign in to comment.