Skip to content

Commit 9f71f30

Browse files
authored
Merge pull request #4671 from Rayzedan/fix/sarif_analyzer_name
[fix] get analyzer name from SARIF report
2 parents 46340ca + 86c4331 commit 9f71f30

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

  • tools/report-converter/codechecker_report_converter/report/parser

tools/report-converter/codechecker_report_converter/report/parser/sarif.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ def get_reports(
6363

6464
for run in data.runs:
6565
rules = self._get_rules(run.run_data)
66+
analyzer_name = self._get_analyzer_name(run.run_data)
6667
# $3.14.14
6768
self.original_uri_base_ids = None
6869
if "originalUriBaseIds" in run.run_data:
@@ -92,6 +93,7 @@ def get_reports(
9293
report = Report(
9394
file, rng.start_line, rng.start_col,
9495
message, rule_id, # TODO: Add severity.
96+
analyzer_name=analyzer_name,
9597
analyzer_result_file_path=analyzer_result_file_path,
9698
bug_path_events=bug_path_events,
9799
bug_path_positions=thread_flow_info.bug_path_positions,
@@ -129,6 +131,10 @@ def _get_rules(self, data: Dict) -> Dict[str, Dict]:
129131

130132
return rules
131133

134+
def _get_analyzer_name(self, data: Dict) -> str:
135+
""" Get analyzer name from SARIF report. """
136+
return data.get("tool", {}).get("driver", {}).get("name", "unknown")
137+
132138
def _process_code_flows(
133139
self,
134140
result: Dict,

0 commit comments

Comments
 (0)