From 9f3b7bcd79b2f9398bee8dfd94df1f1a7eb4d909 Mon Sep 17 00:00:00 2001 From: Alice Pellegrini Date: Sun, 30 Nov 2025 12:42:21 +0100 Subject: [PATCH] Fix SARIF reports to comply with specification --- infer/src/integration/SarifReport.ml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/infer/src/integration/SarifReport.ml b/infer/src/integration/SarifReport.ml index 0420e41ca4e..7dfc9d6db2f 100644 --- a/infer/src/integration/SarifReport.ml +++ b/infer/src/integration/SarifReport.ml @@ -69,9 +69,8 @@ let pp_results_header fmt = let loc_trace_to_sarifbug_record trace_list = let file_loc filename = - let absolute_source_name = Config.project_root ^/ filename in - let file_path = "file:" ^ filename in - {Sarifbug_j.uri= file_path; Sarifbug_j.uriBaseId= absolute_source_name} + let absolute_project_root = "file:" ^ Config.project_root in + {Sarifbug_j.uri= filename; Sarifbug_j.uriBaseId= absolute_project_root} in let message description = {Sarifbug_j.text= description} in let region line_number column_number = @@ -102,9 +101,8 @@ let pp_jsonbug fmt in let level = String.lowercase severity in let ruleId = bug_type in - let absolute_source_name = Config.project_root ^/ file in - let file_path = "file:" ^ file in - let file_loc = {Sarifbug_j.uri= file_path; uriBaseId= absolute_source_name} in + let absolute_project_root = "file:" ^ Config.project_root in + let file_loc = {Sarifbug_j.uri= file; uriBaseId= absolute_project_root} in let region = match column with | -1 ->