Skip to content

Commit

Permalink
[feat][report-converter] Add support for bug path positions (for arrows)
Browse files Browse the repository at this point in the history
sarif files contain all the information required to construct the arrows.
This commit extracts that information and uses it in the report.
  • Loading branch information
Joe Stevens committed Dec 9, 2024
1 parent d084d79 commit a9eaedc
Showing 1 changed file with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,26 +143,30 @@ def _process_code_flows(

thread_flow_info = ThreadFlowInfo()

# TODO: Currently, we only collect bug path events.

for code_flow in result.get("codeFlows", []):
for thread_flow in code_flow.get("threadFlows", []):
for location_data in thread_flow["locations"]:
# There are a lot data stored alongside the location worth
if "location" not in location_data:
continue

# There is a lot data stored alongside the location worth
# parsing, but we only need the actual location now.
location = location_data["location"]

file, rng = self._process_location(location)
if not (file and rng):
continue

thread_flow_info.bug_path_positions.append(
BugPathPosition(file, rng)
)

if "message" not in location:
# TODO: This might be a bug path position (for arrows).
continue

message = self._process_message(
location["message"], rule_id, rules)

file, rng = self._process_location(location)
if not (file and rng):
continue

thread_flow_info.bug_path_events.append(BugPathEvent(
message, file, rng.start_line, rng.start_col, rng))

Expand Down

0 comments on commit a9eaedc

Please sign in to comment.