Reporting cleanup 10: log_frontend_issue

Summary: Actually only `CFrontend_errors` is calling `log_issue_from_errlog` directly, let's rename it, and specify `node_id_key` to `node_key`

Reviewed By: jeremydubreil

Differential Revision: D9360651

fbshipit-source-id: 5d63e51e9
master
Mehdi Bouaziz 6 years ago committed by Facebook Github Bot
parent cc18f9883d
commit 34a6a487c5

@ -12,8 +12,8 @@ type log_t =
?ltr:Errlog.loc_trace -> ?linters_def_file:string -> ?doc_url:string -> ?access:string ?ltr:Errlog.loc_trace -> ?linters_def_file:string -> ?doc_url:string -> ?access:string
-> ?extras:Jsonbug_t.extra -> exn -> unit -> ?extras:Jsonbug_t.extra -> exn -> unit
let log_issue_from_errlog_internal procname ~clang_method_kind severity err_log ~loc ~node_id_key let log_issue_from_errlog procname ~clang_method_kind severity err_log ~loc ~node_id_key ~ltr
~ltr ~linters_def_file ~doc_url ~access ~extras exn = ~linters_def_file ~doc_url ~access ~extras exn =
let issue_type = (Exceptions.recognize_exception exn).name in let issue_type = (Exceptions.recognize_exception exn).name in
if not Config.filtering (* no-filtering takes priority *) || issue_type.IssueType.enabled then if not Config.filtering (* no-filtering takes priority *) || issue_type.IssueType.enabled then
let session = (State.get_session () :> int) in let session = (State.get_session () :> int) in
@ -21,10 +21,10 @@ let log_issue_from_errlog_internal procname ~clang_method_kind severity err_log
~linters_def_file ~doc_url ~access ~extras exn ~linters_def_file ~doc_url ~access ~extras exn
let log_issue_from_errlog procname severity errlog ~loc ~node_id_key ~ltr ~linters_def_file let log_frontend_issue procname severity errlog ~loc ~node_key ~ltr ~linters_def_file ~doc_url exn =
~doc_url exn = let node_id_key = {Errlog.node_id= 0; node_key} in
log_issue_from_errlog_internal procname ~clang_method_kind:None severity errlog ~loc ~node_id_key log_issue_from_errlog procname ~clang_method_kind:None severity errlog ~loc ~node_id_key ~ltr
~ltr ~linters_def_file ~doc_url ~access:None ~extras:None exn ~linters_def_file ~doc_url ~access:None ~extras:None exn
let log_issue_from_summary severity summary ~node_id_key ~loc ?ltr ?linters_def_file ?doc_url let log_issue_from_summary severity summary ~node_id_key ~loc ?ltr ?linters_def_file ?doc_url
@ -48,8 +48,8 @@ let log_issue_from_summary severity summary ~node_id_key ~loc ?ltr ?linters_def_
let err_log = Summary.get_err_log summary in let err_log = Summary.get_err_log summary in
let clang_method_kind = Some attrs.clang_method_kind in let clang_method_kind = Some attrs.clang_method_kind in
let ltr = match ltr with None -> State.get_loc_trace () | Some ltr -> ltr in let ltr = match ltr with None -> State.get_loc_trace () | Some ltr -> ltr in
log_issue_from_errlog_internal procname ~clang_method_kind severity err_log ~loc ~node_id_key log_issue_from_errlog procname ~clang_method_kind severity err_log ~loc ~node_id_key ~ltr
~ltr ~linters_def_file ~doc_url ~access ~extras exn ~linters_def_file ~doc_url ~access ~extras exn
let log_issue_deprecated severity proc_name ?node_id_key ?loc ?ltr ?linters_def_file ?doc_url let log_issue_deprecated severity proc_name ?node_id_key ?loc ?ltr ?linters_def_file ?doc_url
@ -83,8 +83,8 @@ 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 exn =
let errlog = IssueLog.get_errlog procname in let errlog = IssueLog.get_errlog procname in
let node_id_key = State.get_node_id_key () in let node_id_key = State.get_node_id_key () in
log_issue_from_errlog_internal procname ~clang_method_kind:None severity errlog ~loc ~node_id_key log_issue_from_errlog procname ~clang_method_kind:None severity errlog ~loc ~node_id_key ~ltr
~ltr ~linters_def_file:None ~doc_url:None ~access ~extras:None exn ~linters_def_file:None ~doc_url:None ~access ~extras:None exn
let is_suppressed ?(field_name= None) tenv proc_desc kind = let is_suppressed ?(field_name= None) tenv proc_desc kind =

@ -20,11 +20,11 @@ val log_issue_deprecated :
DEPRECATED as it can create race conditions between checkers. DEPRECATED as it can create race conditions between checkers.
Use log_error/warning instead *) Use log_error/warning instead *)
val log_issue_from_errlog : val log_frontend_issue :
Typ.Procname.t -> Exceptions.severity -> Errlog.t -> loc:Location.t Typ.Procname.t -> Exceptions.severity -> Errlog.t -> loc:Location.t
-> node_id_key:Errlog.node_id_key -> ltr:Errlog.loc_trace -> linters_def_file:string option -> node_key:Procdesc.NodeKey.t -> ltr:Errlog.loc_trace -> linters_def_file:string option
-> doc_url:string option -> exn -> unit -> doc_url:string option -> exn -> unit
(** Report an issue of a given kind in the given error log. *) (** Report a frontend issue of a given kind in the given error log. *)
val log_error : Summary.t -> loc:Location.t -> log_t val log_error : Summary.t -> loc:Location.t -> log_t
(** Add an error to the given summary. *) (** Add an error to the given summary. *)

@ -457,9 +457,8 @@ let log_frontend_issue method_decl_opt (node: Ctl_parser_types.ast_node)
CAst_utils.generate_key_stmt st CAst_utils.generate_key_stmt st
in in
let node_key = Procdesc.NodeKey.of_frontend_node_key key_str in let node_key = Procdesc.NodeKey.of_frontend_node_key key_str in
Reporting.log_issue_from_errlog procname issue_desc.severity errlog exn ~loc:issue_desc.loc Reporting.log_frontend_issue procname issue_desc.severity errlog exn ~loc:issue_desc.loc
~ltr:trace ~node_id_key:{Errlog.node_id= 0; node_key} ~linters_def_file ~ltr:trace ~node_key ~linters_def_file ~doc_url:issue_desc.doc_url
~doc_url:issue_desc.doc_url
let fill_issue_desc_info_and_log context ~witness ~current_node (issue_desc: CIssue.issue_desc) let fill_issue_desc_info_and_log context ~witness ~current_node (issue_desc: CIssue.issue_desc)

Loading…
Cancel
Save