node_key: option type

Reviewed By: jeremydubreil

Differential Revision: D9633551

fbshipit-source-id: b80f38950
master
Mehdi Bouaziz 6 years ago committed by Facebook Github Bot
parent 1c24102e45
commit ec9f4c2c6a

@ -75,7 +75,7 @@ type err_key =
(** Data associated to a specific error *) (** Data associated to a specific error *)
type err_data = type err_data =
{ node_id: int { node_id: int
; node_key: Procdesc.NodeKey.t ; node_key: Procdesc.NodeKey.t option
; session: int ; session: int
; loc: Location.t ; loc: Location.t
; loc_in_ml_source: L.ocaml_pos option ; loc_in_ml_source: L.ocaml_pos option
@ -266,11 +266,11 @@ let log_issue procname ~clang_method_kind severity err_log ~loc ~node ~session ~
let node_id, node_key = let node_id, node_key =
match node with match node with
| UnknownNode -> | UnknownNode ->
(0, Procdesc.NodeKey.dummy) (0, Some Procdesc.NodeKey.dummy)
| FrontendNode {node_key} -> | FrontendNode {node_key} ->
(0, node_key) (0, Some node_key)
| BackendNode {node} -> | BackendNode {node} ->
((Procdesc.Node.get_id node :> int), Procdesc.Node.compute_key node) ((Procdesc.Node.get_id node :> int), Some (Procdesc.Node.compute_key node))
in in
let err_data = let err_data =
{ node_id { node_id

@ -49,7 +49,7 @@ type err_key = private
(** Data associated to a specific error *) (** Data associated to a specific error *)
type err_data = private type err_data = private
{ node_id: int { node_id: int
; node_key: Procdesc.NodeKey.t ; node_key: Procdesc.NodeKey.t option
; session: int ; session: int
; loc: Location.t ; loc: Location.t
; loc_in_ml_source: Logging.ocaml_pos option ; loc_in_ml_source: Logging.ocaml_pos option

@ -32,7 +32,7 @@ type jsonbug = {
file : string; file : string;
bug_trace : json_trace_item list; bug_trace : json_trace_item list;
key : string; key : string;
node_key : string; ?node_key : string option;
hash : string; hash : string;
?dotty : string option; ?dotty : string option;
?infer_source_loc: loc option; ?infer_source_loc: loc option;
@ -57,4 +57,3 @@ type cost_item = {
} }
type costs_report = cost_item list type costs_report = cost_item list

@ -118,7 +118,7 @@ let relative_complements ~compare ~pred l1 l2 =
let skip_duplicated_types_on_filenames renamings (diff : Differential.t) : Differential.t = let skip_duplicated_types_on_filenames renamings (diff : Differential.t) : Differential.t =
let compare (issue1, previous_file1) (issue2, previous_file2) = let compare (issue1, previous_file1) (issue2, previous_file2) =
[%compare: Caml.Digest.t * string * string] [%compare: Caml.Digest.t option * string * string]
(issue1.Jsonbug_t.node_key, issue1.Jsonbug_t.bug_type, previous_file1) (issue1.Jsonbug_t.node_key, issue1.Jsonbug_t.bug_type, previous_file1)
(issue2.Jsonbug_t.node_key, issue2.Jsonbug_t.bug_type, previous_file2) (issue2.Jsonbug_t.node_key, issue2.Jsonbug_t.bug_type, previous_file2)
in in
@ -132,7 +132,8 @@ let skip_duplicated_types_on_filenames renamings (diff : Differential.t) : Diffe
in in
let fixed_normalized = List.map diff.fixed ~f:(fun f -> (f, f.Jsonbug_t.file)) in let fixed_normalized = List.map diff.fixed ~f:(fun f -> (f, f.Jsonbug_t.file)) in
let introduced_normalized', preexisting', fixed_normalized' = let introduced_normalized', preexisting', fixed_normalized' =
relative_complements ~compare ~pred:(fun _ -> true) introduced_normalized fixed_normalized let has_node_key ({Jsonbug_t.node_key}, _) = Option.is_some node_key in
relative_complements ~compare ~pred:has_node_key introduced_normalized fixed_normalized
in in
let list_map_fst = List.map ~f:fst in let list_map_fst = List.map ~f:fst in
( list_map_fst introduced_normalized' ( list_map_fst introduced_normalized'

@ -313,7 +313,7 @@ module JsonIssuePrinter = MakeJsonListPrinter (struct
; procedure_start_line ; procedure_start_line
; file ; file
; bug_trace= loc_trace_to_jsonbug_record err_data.loc_trace err_key.severity ; bug_trace= loc_trace_to_jsonbug_record err_data.loc_trace err_key.severity
; node_key= Procdesc.NodeKey.to_string err_data.node_key ; node_key= Option.map ~f:Procdesc.NodeKey.to_string err_data.node_key
; key= compute_key bug_type proc_name file ; key= compute_key bug_type proc_name file
; hash= compute_hash severity bug_type proc_name file qualifier ; hash= compute_hash severity bug_type proc_name file qualifier
; dotty= error_desc_to_dotty_string err_key.err_desc ; dotty= error_desc_to_dotty_string err_key.err_desc

@ -10,7 +10,7 @@ open! IStd
let create_fake_jsonbug ?(kind = "kind") ?(bug_type = "bug_type") ?(qualifier = "qualifier") let create_fake_jsonbug ?(kind = "kind") ?(bug_type = "bug_type") ?(qualifier = "qualifier")
?(severity = "severity") ?(visibility = "visibility") ?(line = 1) ?(column = 1) ?(severity = "severity") ?(visibility = "visibility") ?(line = 1) ?(column = 1)
?(procedure = "procedure") ?(procedure_start_line = 1) ?(file = "file/at/a/certain/path.java") ?(procedure = "procedure") ?(procedure_start_line = 1) ?(file = "file/at/a/certain/path.java")
?(bug_trace = []) ?(node_key = "File|method|TYPE") ?(key = "1234") ?(hash = "1") ?(bug_trace = []) ?(key = "File|method|TYPE") ?(node_key = Some "1234") ?(hash = "1")
?(dotty = None) ?(infer_source_loc = None) ?(linters_def_file = Some "file/at/certain/path.al") ?(dotty = None) ?(infer_source_loc = None) ?(linters_def_file = Some "file/at/certain/path.al")
?doc_url () : Jsonbug_t.jsonbug = ?doc_url () : Jsonbug_t.jsonbug =
{ kind { kind

Loading…
Cancel
Save