def fix_addons_linter_output(validation, listed=True):
 if ('messages' in validation):
  return validation
 def _merged_messages():
  for type_ in ('errors', 'notices', 'warnings'):
   for msg in validation[type_]:
    msg['uid'] = uuid.uuid4().hex
    msg['type'] = msg.pop('_type')
    msg['id'] = [msg.pop('code')]
    msg['tier'] = 1
    (yield msg)
 identified_files = {name: {'path': path} for (name, path) in validation['metadata'].get('jsLibs', {}).items()}
 return {'success': (not validation['errors']), 'compatibility_summary': {'warnings': 0, 'errors': 0, 'notices': 0}, 'notices': validation['summary']['notices'], 'warnings': validation['summary']['warnings'], 'errors': validation['summary']['errors'], 'messages': list(_merged_messages()), 'metadata': {'listed': listed, 'identified_files': identified_files, 'processed_by_addons_linter': True, 'is_webextension': True}, 'signing_summary': {'low': 0, 'medium': 0, 'high': 0, 'trivial': 0}, 'detected_type': 'extension', 'ending_tier': 5}

def fix_addons_linter_output ( validation , listed = True ) : if ( 'messages' in validation ) : return validation def _merged_messages ( ) : for type_ in ( 'errors' , 'notices' , 'warnings' ) : for msg in validation [ type_ ] : msg [ 'uid' ] = uuid . uuid4 ( ) . hex msg [ 'type' ] = msg . pop ( '_type' ) msg [ 'id' ] = [ msg . pop ( 'code' ) ] msg [ 'tier' ] = 1 ( yield msg ) identified_files = { name : { 'path' : path } for ( name , path ) in validation [ 'metadata' ] . get ( 'jsLibs' , { } ) . items ( ) } return { 'success' : ( not validation [ 'errors' ] ) , 'compatibility_summary' : { 'warnings' : 0 , 'errors' : 0 , 'notices' : 0 } , 'notices' : validation [ 'summary' ] [ 'notices' ] , 'warnings' : validation [ 'summary' ] [ 'warnings' ] , 'errors' : validation [ 'summary' ] [ 'errors' ] , 'messages' : list ( _merged_messages ( ) ) , 'metadata' : { 'listed' : listed , 'identified_files' : identified_files , 'processed_by_addons_linter' : True , 'is_webextension' : True } , 'signing_summary' : { 'low' : 0 , 'medium' : 0 , 'high' : 0 , 'trivial' : 0 } , 'detected_type' : 'extension' , 'ending_tier' : 5 }
make sure the output from the addons-linter is the same as amo-validator for backwards compatibility reasons .