Prepend path index to data flow results; use single newlines

This commit is contained in:
Michael Hohn
2021-12-08 16:28:32 -08:00
committed by =Michael Hohn
parent f1d21e4a43
commit 5386310b1b

View File

@@ -49,7 +49,7 @@ for runi in S.indices(sarif_struct, 'runs'):
if args.csv:
S.write_csv(cw, "result", artifact['uri'], l1, c1, l2, c2, message)
else:
S.msg("RESULT: %s: %s\n\n" % (filepath, message))
S.msg("RESULT: %s: %s\n" % (filepath, message))
if region != S.WholeFile and args.list_source:
lines = S.load_lines(args.list_source, artifact['uri'], l1, l2)
@@ -69,7 +69,7 @@ for runi in S.indices(sarif_struct, 'runs'):
if args.csv:
S.write_csv(cw, "result", "", -1, -1, -1, -1, message)
else:
S.msg("REFERENCE: %s: %s\n\n" % ("<NoFile>", message))
S.msg("REFERENCE: %s: %s\n" % ("<NoFile>", message))
else:
if region == S.WholeFile:
l1, c1, l2, c2 = -1, -1, -1, -1
@@ -80,7 +80,7 @@ for runi in S.indices(sarif_struct, 'runs'):
if args.csv:
S.write_csv(cw, "result", artifact['uri'], l1, c1, l2, c2, message)
else:
S.msg("REFERENCE: %s: %s\n\n" % (filepath, message))
S.msg("REFERENCE: %s: %s\n" % (filepath, message))
if args.list_source:
lines = S.load_lines(args.list_source, artifact['uri'], l1, l2)
if args.csv:
@@ -90,8 +90,14 @@ for runi in S.indices(sarif_struct, 'runs'):
S.display_underlined(l1, c1, l2, c2, line, line_num)
if 'codeFlows' in result:
# Path problems
for codeFlow in S.get(result, 'codeFlows'):
for threadFlow in S.get(codeFlow, 'threadFlows'):
for codefi in S.indices(result, 'codeFlows'):
codeFlow = S.get(result, 'codeFlows', codefi)
if args.csv:
S.write_csv(cw, "path", codefi)
else:
S.msg("PATH %d\n" % codefi)
for threadi in S.indices(codeFlow, 'threadFlows'):
threadFlow = S.get(codeFlow, 'threadFlows', threadi)
for loci in S.indices(threadFlow, 'locations'):
location = S.get(threadFlow, 'locations', loci, 'location')
message, artifact, region = S.get_relatedlocation_message_info(location)
@@ -99,7 +105,7 @@ for runi in S.indices(sarif_struct, 'runs'):
if args.csv:
S.write_csv(cw, "flow_step", loci, "<NoFile>", -1, -1, -1, -1, message)
else:
S.msg("FLOW STEP %d: %s: %s\n\n" % (loci, "<NoFile>", message))
S.msg("FLOW STEP %d: %s: %s\n" % (loci, "<NoFile>", message))
else:
if region == S.WholeFile:
l1, c1, l2, c2 = -1, -1, -1, -1
@@ -109,7 +115,7 @@ for runi in S.indices(sarif_struct, 'runs'):
if args.csv:
S.write_csv(cw, "flow_step", loci, artifact['uri'], l1, c1, l2, c2, message)
else:
S.msg("FLOW STEP %d: %s: %s\n\n" % (loci, filepath, message))
S.msg("FLOW STEP %d: %s: %s\n" % (loci, filepath, message))
if args.list_source:
lines = S.load_lines(args.list_source, artifact['uri'], l1, l2)
if args.csv: