Reviewed By: jeremydubreil Differential Revision: D9688756 fbshipit-source-id: 2487f15aamaster
parent
249ef9d75b
commit
46cd49df8d
@ -1,31 +0,0 @@
|
|||||||
(*
|
|
||||||
* Copyright (c) 2013-present, Facebook, Inc.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree.
|
|
||||||
*)
|
|
||||||
|
|
||||||
open! IStd
|
|
||||||
|
|
||||||
(** Module for user-defined checkers. *)
|
|
||||||
|
|
||||||
module ST = struct
|
|
||||||
let report_error tenv proc_name proc_desc kind loc ?(field_name = None) ?(origin_loc = None)
|
|
||||||
?(exception_kind = fun k d -> Exceptions.Checkers (k, d)) ?(severity = Exceptions.Warning)
|
|
||||||
description =
|
|
||||||
let suppressed = Reporting.is_suppressed tenv proc_desc kind ~field_name in
|
|
||||||
if not suppressed then
|
|
||||||
let localized_description = Localise.custom_desc description [] in
|
|
||||||
let exn = exception_kind kind localized_description in
|
|
||||||
let trace =
|
|
||||||
let origin_elements =
|
|
||||||
match origin_loc with
|
|
||||||
| Some oloc ->
|
|
||||||
[Errlog.make_trace_element 0 oloc "origin" []]
|
|
||||||
| None ->
|
|
||||||
[]
|
|
||||||
in
|
|
||||||
origin_elements @ [Errlog.make_trace_element 0 loc description []]
|
|
||||||
in
|
|
||||||
Reporting.log_issue_deprecated_using_state severity proc_name ~loc ~ltr:trace exn
|
|
||||||
end
|
|
@ -1,26 +0,0 @@
|
|||||||
(*
|
|
||||||
* Copyright (c) 2013-present, Facebook, Inc.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree.
|
|
||||||
*)
|
|
||||||
|
|
||||||
open! IStd
|
|
||||||
|
|
||||||
(** Module for user-defined checkers. *)
|
|
||||||
|
|
||||||
module ST : sig
|
|
||||||
val report_error :
|
|
||||||
Tenv.t
|
|
||||||
-> Typ.Procname.t
|
|
||||||
-> Procdesc.t
|
|
||||||
-> IssueType.t
|
|
||||||
-> Location.t
|
|
||||||
-> ?field_name:Typ.Fieldname.t option
|
|
||||||
-> ?origin_loc:Location.t option
|
|
||||||
-> ?exception_kind:(IssueType.t -> Localise.error_desc -> exn)
|
|
||||||
-> ?severity:Exceptions.severity
|
|
||||||
-> string
|
|
||||||
-> unit
|
|
||||||
(** Report an error. *)
|
|
||||||
end
|
|
@ -0,0 +1,29 @@
|
|||||||
|
(*
|
||||||
|
* Copyright (c) 2013-present, Facebook, Inc.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*)
|
||||||
|
|
||||||
|
open! IStd
|
||||||
|
|
||||||
|
(** Module for Eradicate-based user-defined checkers. *)
|
||||||
|
|
||||||
|
let report_error tenv proc_name proc_desc kind loc ?(field_name = None) ?(origin_loc = None)
|
||||||
|
?(exception_kind = fun k d -> Exceptions.Checkers (k, d)) ?(severity = Exceptions.Warning)
|
||||||
|
description =
|
||||||
|
let suppressed = Reporting.is_suppressed tenv proc_desc kind ~field_name in
|
||||||
|
if not suppressed then
|
||||||
|
let localized_description = Localise.verbatim_desc description in
|
||||||
|
let exn = exception_kind kind localized_description in
|
||||||
|
let trace =
|
||||||
|
let origin_elements =
|
||||||
|
match origin_loc with
|
||||||
|
| Some oloc ->
|
||||||
|
[Errlog.make_trace_element 0 oloc "origin" []]
|
||||||
|
| None ->
|
||||||
|
[]
|
||||||
|
in
|
||||||
|
origin_elements @ [Errlog.make_trace_element 0 loc description []]
|
||||||
|
in
|
||||||
|
Reporting.log_issue_deprecated_using_state severity proc_name ~loc ~ltr:trace exn
|
@ -0,0 +1,24 @@
|
|||||||
|
(*
|
||||||
|
* Copyright (c) 2013-present, Facebook, Inc.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*)
|
||||||
|
|
||||||
|
open! IStd
|
||||||
|
|
||||||
|
(** Module for Eradicate-based user-defined checkers. *)
|
||||||
|
|
||||||
|
val report_error :
|
||||||
|
Tenv.t
|
||||||
|
-> Typ.Procname.t
|
||||||
|
-> Procdesc.t
|
||||||
|
-> IssueType.t
|
||||||
|
-> Location.t
|
||||||
|
-> ?field_name:Typ.Fieldname.t option
|
||||||
|
-> ?origin_loc:Location.t option
|
||||||
|
-> ?exception_kind:(IssueType.t -> Localise.error_desc -> exn)
|
||||||
|
-> ?severity:Exceptions.severity
|
||||||
|
-> string
|
||||||
|
-> unit
|
||||||
|
(** Report an error. *)
|
Loading…
Reference in new issue