Reporting cleanup 11: node_id

Reviewed By: jvillard

Differential Revision: D9360697

fbshipit-source-id: 688aae944
master
Mehdi Bouaziz 7 years ago committed by Facebook Github Bot
parent 3f4cb5cae9
commit 3986a823f8

@ -60,7 +60,9 @@ let compute_local_exception_line loc_trace =
List.fold_until ~init:(None, None) ~f:compute_local_exception_line ~finish:snd loc_trace
type node_id_key = {node_id: int; node_key: Procdesc.NodeKey.t}
type node_id_key =
| FrontendNode of {node_key: Procdesc.NodeKey.t}
| BackendNode of {node_id: Procdesc.Node.id; node_key: Procdesc.NodeKey.t}
type err_key =
{ severity: Exceptions.severity
@ -171,8 +173,15 @@ let pp_warnings fmt (errlog: t) =
let pp_html source path_to_root fmt (errlog: t) =
let pp_eds fmt err_datas =
let pp_nodeid_session_loc fmt err_data =
let node_id =
match err_data.node_id_key with
| FrontendNode _ ->
0
| BackendNode {node_id} ->
(node_id :> int)
in
Io_infer.Html.pp_session_link source path_to_root fmt
(err_data.node_id_key.node_id, err_data.session, err_data.loc.Location.line)
(node_id, err_data.session, err_data.loc.Location.line)
in
ErrDataSet.iter (pp_nodeid_session_loc fmt) err_datas
in

@ -34,7 +34,9 @@ val compute_local_exception_line : loc_trace -> int option
This extra information adds value to the report itself, and may avoid
digging into the trace to understand the cause of the report. *)
type node_id_key = {node_id: int; node_key: Procdesc.NodeKey.t}
type node_id_key =
| FrontendNode of {node_key: Procdesc.NodeKey.t}
| BackendNode of {node_id: Procdesc.Node.id; node_key: Procdesc.NodeKey.t}
type err_key = private
{ severity: Exceptions.severity

@ -301,6 +301,11 @@ module JsonIssuePrinter = MakeJsonListPrinter (struct
| _ ->
Typ.Procname.to_string proc_name
in
let node_key =
match err_data.node_id_key with
| FrontendNode {node_key} | BackendNode {node_key} ->
Procdesc.NodeKey.to_string node_key
in
let bug =
{ Jsonbug_j.bug_class= Exceptions.err_class_string err_data.err_class
; kind= severity
@ -315,7 +320,7 @@ module JsonIssuePrinter = MakeJsonListPrinter (struct
; procedure_start_line
; file
; bug_trace= loc_trace_to_jsonbug_record err_data.loc_trace err_key.severity
; node_key= err_data.node_id_key.node_key |> Procdesc.NodeKey.to_string
; node_key
; key= compute_key bug_type proc_name file
; hash= compute_hash severity bug_type proc_name file qualifier
; dotty= error_desc_to_dotty_string err_key.err_desc

@ -22,7 +22,7 @@ let log_issue_from_errlog procname ~clang_method_kind severity err_log ~loc ~nod
let log_frontend_issue procname severity errlog ~loc ~node_key ~ltr ~linters_def_file ~doc_url exn =
let node_id_key = {Errlog.node_id= 0; node_key} in
let node_id_key = Errlog.FrontendNode {node_key} in
log_issue_from_errlog procname ~clang_method_kind:None severity errlog ~loc ~node_id_key ~ltr
~linters_def_file ~doc_url ~access:None ~extras:None exn

@ -165,8 +165,8 @@ let mk_find_duplicate_nodes : Procdesc.t -> Procdesc.Node.t -> Procdesc.NodeSet.
let get_node_id () = Procdesc.Node.get_id !gs.last_node
let get_node_id_key () =
{ Errlog.node_id= (Procdesc.Node.get_id !gs.last_node :> int)
; node_key= Procdesc.Node.compute_key !gs.last_node }
Errlog.BackendNode
{node_id= Procdesc.Node.get_id !gs.last_node; node_key= Procdesc.Node.compute_key !gs.last_node}
let get_inst_update pos =

Loading…
Cancel
Save