Reporting cleanup 13: log_issue_external

Reviewed By: jvillard

Differential Revision: D9369295

fbshipit-source-id: faf56b177
master
Mehdi Bouaziz 7 years ago committed by Facebook Github Bot
parent 9dad4c3648
commit 6bb429ef63

@ -61,6 +61,7 @@ let compute_local_exception_line loc_trace =
type node =
| UnknownNode
| FrontendNode of {node_key: Procdesc.NodeKey.t}
| BackendNode of {node: Procdesc.Node.t}
@ -264,6 +265,8 @@ let log_issue procname ~clang_method_kind severity err_log ~loc ~node ~session ~
let added =
let node_id, node_key =
match node with
| UnknownNode ->
(0, Procdesc.NodeKey.dummy)
| FrontendNode {node_key} ->
(0, node_key)
| BackendNode {node} ->

@ -35,6 +35,7 @@ val compute_local_exception_line : loc_trace -> int option
digging into the trace to understand the cause of the report. *)
type node =
| UnknownNode
| FrontendNode of {node_key: Procdesc.NodeKey.t}
| BackendNode of {node: Procdesc.Node.t}

@ -24,6 +24,8 @@ module NodeKey = struct
let of_frontend_node_key = Utils.better_hash
let dummy = Utils.better_hash "DUMMY"
end
(* =============== START of module Node =============== *)

@ -11,6 +11,8 @@ open! IStd
module NodeKey : sig
type t
val dummy : t
val to_string : t -> string
val of_frontend_node_key : string -> t

@ -79,9 +79,10 @@ let log_error = log_issue_from_summary_simplified Exceptions.Error
let log_warning = log_issue_from_summary_simplified Exceptions.Warning
let log_issue_external procname severity ~loc ~ltr ?access exn =
let log_issue_external procname severity ~loc ~ltr ?access issue_type error_message =
let exn = Exceptions.Checkers (issue_type, Localise.verbatim_desc error_message) in
let errlog = IssueLog.get_errlog procname in
let node = Errlog.BackendNode {node= State.get_node ()} in
let node = Errlog.UnknownNode in
log_issue_from_errlog procname ~clang_method_kind:None severity errlog ~loc ~node ~ltr
~linters_def_file:None ~doc_url:None ~access ~extras:None exn

@ -33,7 +33,7 @@ val log_warning : Summary.t -> loc:Location.t -> log_t
val log_issue_external :
Typ.Procname.t -> Exceptions.severity -> loc:Location.t -> ltr:Errlog.loc_trace -> ?access:string
-> exn -> unit
-> IssueType.t -> string -> unit
(** Log an issue to the error log in [IssueLog] associated with the given procname. *)
val is_suppressed :

@ -914,8 +914,9 @@ let is_contaminated access wobbly_paths =
false
let log_issue current_pname ~loc ~ltr ~access exn =
Reporting.log_issue_external current_pname Exceptions.Error ~loc ~ltr ~access exn
let log_issue current_pname ~loc ~ltr ~access issue_type error_message =
Reporting.log_issue_external current_pname Exceptions.Error ~loc ~ltr ~access issue_type
error_message
let report_thread_safety_violation tenv pdesc ~make_description ~report_kind access thread
@ -939,10 +940,9 @@ let report_thread_safety_violation tenv pdesc ~make_description ~report_kind acc
(* why we are reporting it *)
let issue_type, explanation = get_reporting_explanation report_kind tenv pname thread in
let error_message = F.sprintf "%s%s" description explanation in
let exn = Exceptions.Checkers (issue_type, Localise.verbatim_desc error_message) in
let end_locs = Option.to_list original_end @ Option.to_list conflict_end in
let access = IssueAuxData.encode (pname, access, end_locs) in
log_issue pname ~loc ~ltr ~access exn
log_issue pname ~loc ~ltr ~access issue_type error_message
in
let trace_of_pname = trace_of_pname access pdesc in
Option.iter ~f:report_one_path (PathDomain.get_reportable_sink_path access ~trace_of_pname)

@ -225,8 +225,7 @@ end = struct
let log map =
let log_report issuetype loc {pname; ltr; message} =
let exn = Exceptions.Checkers (issuetype, Localise.verbatim_desc message) in
Reporting.log_issue_external pname Exceptions.Error ~loc ~ltr exn
Reporting.log_issue_external pname Exceptions.Error ~loc ~ltr issuetype message
in
let mk_deduped_report num_of_reports ({message} as report) =
{ report with

Loading…
Cancel
Save