Introduce get_relatedlocation_message_info to co-locate tree information

This commit is contained in:
Michael Hohn
2021-11-17 16:34:20 -08:00
committed by =Michael Hohn
parent 1f7e78b049
commit 6147e57260
2 changed files with 13 additions and 4 deletions

View File

@@ -6,6 +6,17 @@ MIN_PYTHON = (3, 7)
if sys.version_info < MIN_PYTHON:
sys.exit("Python %s.%s or later is required.\n" % MIN_PYTHON)
def get_relatedlocation_message_info(related_location):
""" Given a relatedLocation, extract message information.
The relatedLocation typically starts from
get(sarif_struct, 'runs', [int], 'results', [int], 'relatedLocations', [int])
"""
message = get(related_location, 'message', 'text')
artifact = get(related_location, 'physicalLocation', 'artifactLocation')
region = get(related_location, 'physicalLocation', 'region')
return message, artifact, region
def get_location_message_info(result):
""" Given one of the results, extract message information.