[Exceptions] kill `category`

Summary:
It was unused except one place in JsonReports where we disabled
filtering for the Linters category. But, it seems the behaviour is the
same without that since the only filtering this does is for bucketting
for certain bug types, which doesn't include any linters bug types.

Reviewed By: ngorogiannis

Differential Revision: D21683723

fbshipit-source-id: d0555531b
master
Jules Villard 5 years ago committed by Facebook GitHub Bot
parent 5572484eea
commit 64f18f0933

@ -84,7 +84,6 @@ type err_data =
; loc: Location.t
; loc_in_ml_source: L.ocaml_pos option
; loc_trace: loc_trace
; err_class: Exceptions.err_class
; visibility: Exceptions.visibility
; linters_def_file: string option
; doc_url: string option
@ -252,7 +251,6 @@ let log_issue severity err_log ~loc ~node ~session ~ltr ~linters_def_file ~doc_u
; loc
; loc_in_ml_source= error.ocaml_pos
; loc_trace= ltr
; err_class= error.category
; visibility= error.visibility
; linters_def_file
; doc_url

@ -52,7 +52,6 @@ type err_data = private
; loc: Location.t
; loc_in_ml_source: Logging.ocaml_pos option
; loc_trace: loc_trace
; err_class: Exceptions.err_class
; visibility: Exceptions.visibility
; linters_def_file: string option
; doc_url: string option (** url to documentation of the issue type *)

@ -19,11 +19,6 @@ type visibility =
let equal_visibility = [%compare.equal: visibility]
(** class of error/warning *)
type err_class = Checker | Prover | Nocat | Linters [@@deriving compare]
let equal_err_class = [%compare.equal: err_class]
(** severity of the report *)
type severity = Like | Info | Advice | Warning | Error [@@deriving compare]
@ -119,8 +114,7 @@ type t =
; description: Localise.error_desc
; ocaml_pos: L.ocaml_pos option (** location in the infer source code *)
; visibility: visibility
; severity: severity option
; category: err_class }
; severity: severity option }
let recognize_exception exn =
match exn with
@ -129,80 +123,69 @@ let recognize_exception exn =
; description= Localise.no_desc
; ocaml_pos= Some ocaml_pos
; visibility= Exn_developer
; severity= None
; category= Nocat }
; severity= None }
| Analysis_stops (desc, ocaml_pos_opt) ->
let visibility = if Config.analysis_stops then Exn_user else Exn_developer in
{ issue_type= IssueType.analysis_stops
; description= desc
; ocaml_pos= ocaml_pos_opt
; visibility
; severity= None
; category= Nocat }
; severity= None }
| Array_of_pointsto ocaml_pos ->
{ issue_type= IssueType.array_of_pointsto
; description= Localise.no_desc
; ocaml_pos= Some ocaml_pos
; visibility= Exn_developer
; severity= None
; category= Nocat }
; severity= None }
| Array_out_of_bounds_l1 (desc, ocaml_pos) ->
{ issue_type= IssueType.array_out_of_bounds_l1
; description= desc
; ocaml_pos= Some ocaml_pos
; visibility= Exn_developer
; severity= Some Error
; category= Checker }
; severity= Some Error }
| Array_out_of_bounds_l2 (desc, ocaml_pos) ->
{ issue_type= IssueType.array_out_of_bounds_l2
; description= desc
; ocaml_pos= Some ocaml_pos
; visibility= Exn_developer
; severity= None
; category= Nocat }
; severity= None }
| Array_out_of_bounds_l3 (desc, ocaml_pos) ->
{ issue_type= IssueType.array_out_of_bounds_l3
; description= desc
; ocaml_pos= Some ocaml_pos
; visibility= Exn_developer
; severity= None
; category= Nocat }
; severity= None }
| Assert_failure (f, l, c) ->
let ocaml_pos = (f, l, c, c) in
{ issue_type= IssueType.assert_failure
; description= Localise.no_desc
; ocaml_pos= Some ocaml_pos
; visibility= Exn_developer
; severity= None
; category= Nocat }
; severity= None }
| Bad_footprint ocaml_pos ->
{ issue_type= IssueType.bad_footprint
; description= Localise.no_desc
; ocaml_pos= Some ocaml_pos
; visibility= Exn_developer
; severity= None
; category= Nocat }
; severity= None }
| Biabd_use_after_free (desc, ocaml_pos) ->
{ issue_type= IssueType.biabd_use_after_free
; description= desc
; ocaml_pos= Some ocaml_pos
; visibility= Exn_user
; severity= None
; category= Prover }
; severity= None }
| Cannot_star ocaml_pos ->
{ issue_type= IssueType.cannot_star
; description= Localise.no_desc
; ocaml_pos= Some ocaml_pos
; visibility= Exn_developer
; severity= None
; category= Nocat }
; severity= None }
| Class_cast_exception (desc, ocaml_pos) ->
{ issue_type= IssueType.class_cast_exception
; description= desc
; ocaml_pos= Some ocaml_pos
; visibility= Exn_developer
; severity= None
; category= Prover }
; severity= None }
| Condition_always_true_false (desc, b, ocaml_pos) ->
let issue_type =
if b then IssueType.biabd_condition_always_true else IssueType.biabd_condition_always_false
@ -211,143 +194,115 @@ let recognize_exception exn =
; description= desc
; ocaml_pos= Some ocaml_pos
; visibility= Exn_user
; severity= None
; category= Nocat }
; severity= None }
| Custom_error (error_msg, desc) ->
{ issue_type= IssueType.register_from_string ~id:error_msg Biabduction
; description= desc
; ocaml_pos= None
; visibility= Exn_user
; severity= None
; category= Checker }
; severity= None }
| Dummy_exception desc ->
{ issue_type= IssueType.analysis_stops
; description= desc
; ocaml_pos= None
; visibility= Exn_developer
; severity= Some Info
; category= Checker }
; severity= Some Info }
| Dangling_pointer_dereference (user_visible, desc, ocaml_pos) ->
let visibility = if user_visible then Exn_user else Exn_developer in
{ issue_type= IssueType.dangling_pointer_dereference
; description= desc
; ocaml_pos= Some ocaml_pos
; visibility
; severity= None
; category= Prover }
; severity= None }
| Deallocate_stack_variable desc ->
{ issue_type= IssueType.deallocate_stack_variable
; description= desc
; ocaml_pos= None
; visibility= Exn_user
; severity= None
; category= Prover }
; severity= None }
| Deallocate_static_memory desc ->
{ issue_type= IssueType.deallocate_static_memory
; description= desc
; ocaml_pos= None
; visibility= Exn_user
; severity= None
; category= Prover }
; severity= None }
| Deallocation_mismatch (desc, ocaml_pos) ->
{ issue_type= IssueType.deallocation_mismatch
; description= desc
; ocaml_pos= Some ocaml_pos
; visibility= Exn_user
; severity= None
; category= Prover }
; severity= None }
| Divide_by_zero (desc, ocaml_pos) ->
{ issue_type= IssueType.divide_by_zero
; description= desc
; ocaml_pos= Some ocaml_pos
; visibility= Exn_user
; severity= Some Error
; category= Checker }
; severity= Some Error }
| Eradicate (kind, desc) ->
{ issue_type= kind
; description= desc
; ocaml_pos= None
; visibility= Exn_user
; severity= None
; category= Prover }
{issue_type= kind; description= desc; ocaml_pos= None; visibility= Exn_user; severity= None}
| Empty_vector_access (desc, ocaml_pos) ->
{ issue_type= IssueType.empty_vector_access
; description= desc
; ocaml_pos= Some ocaml_pos
; visibility= Exn_user
; severity= Some Error
; category= Prover }
; severity= Some Error }
| Field_not_null_checked (desc, ocaml_pos) ->
{ issue_type= IssueType.field_not_null_checked
; description= desc
; ocaml_pos= Some ocaml_pos
; visibility= Exn_user
; severity= Some Warning
; category= Nocat }
; severity= Some Warning }
| Frontend_warning (issue_type, desc, ocaml_pos) ->
{ issue_type
; description= desc
; ocaml_pos= Some ocaml_pos
; visibility= Exn_user
; severity= None
; category= Linters }
; severity= None }
| Checkers (kind, desc) ->
{ issue_type= kind
; description= desc
; ocaml_pos= None
; visibility= Exn_user
; severity= None
; category= Prover }
{issue_type= kind; description= desc; ocaml_pos= None; visibility= Exn_user; severity= None}
| Null_dereference (desc, ocaml_pos) ->
{ issue_type= IssueType.null_dereference
; description= desc
; ocaml_pos= Some ocaml_pos
; visibility= Exn_user
; severity= None
; category= Prover }
; severity= None }
| Null_test_after_dereference (desc, ocaml_pos) ->
{ issue_type= IssueType.null_test_after_dereference
; description= desc
; ocaml_pos= Some ocaml_pos
; visibility= Exn_user
; severity= None
; category= Nocat }
; severity= None }
| Pointer_size_mismatch (desc, ocaml_pos) ->
{ issue_type= IssueType.pointer_size_mismatch
; description= desc
; ocaml_pos= Some ocaml_pos
; visibility= Exn_user
; severity= Some Error
; category= Checker }
; severity= Some Error }
| Inherently_dangerous_function desc ->
{ issue_type= IssueType.inherently_dangerous_function
; description= desc
; ocaml_pos= None
; visibility= Exn_developer
; severity= None
; category= Nocat }
; severity= None }
| Internal_error desc ->
{ issue_type= IssueType.internal_error
; description= desc
; ocaml_pos= None
; visibility= Exn_developer
; severity= None
; category= Nocat }
; severity= None }
| Leak (fp_part, (exn_vis, error_desc), done_array_abstraction, resource, ocaml_pos) ->
if done_array_abstraction then
{ issue_type= IssueType.leak_after_array_abstraction
; description= error_desc
; ocaml_pos= Some ocaml_pos
; visibility= Exn_developer
; severity= None
; category= Prover }
; severity= None }
else if fp_part then
{ issue_type= IssueType.leak_in_footprint
; description= error_desc
; ocaml_pos= Some ocaml_pos
; visibility= Exn_developer
; severity= None
; category= Prover }
; severity= None }
else
let issue_type =
match resource with
@ -364,117 +319,101 @@ let recognize_exception exn =
; description= error_desc
; ocaml_pos= Some ocaml_pos
; visibility= exn_vis
; severity= None
; category= Prover }
; severity= None }
| Missing_fld (fld, ocaml_pos) ->
let desc = Localise.verbatim_desc (Fieldname.to_full_string fld) in
{ issue_type= IssueType.missing_fld
; description= desc
; ocaml_pos= Some ocaml_pos
; visibility= Exn_developer
; severity= None
; category= Nocat }
; severity= None }
| Premature_nil_termination (desc, ocaml_pos) ->
{ issue_type= IssueType.premature_nil_termination
; description= desc
; ocaml_pos= Some ocaml_pos
; visibility= Exn_user
; severity= None
; category= Prover }
; severity= None }
| Parameter_not_null_checked (desc, ocaml_pos) ->
{ issue_type= IssueType.parameter_not_null_checked
; description= desc
; ocaml_pos= Some ocaml_pos
; visibility= Exn_user
; severity= Some Warning
; category= Nocat }
; severity= Some Warning }
| Precondition_not_found (desc, ocaml_pos) ->
{ issue_type= IssueType.precondition_not_found
; description= desc
; ocaml_pos= Some ocaml_pos
; visibility= Exn_developer
; severity= None
; category= Nocat }
; severity= None }
| Precondition_not_met (desc, ocaml_pos) ->
{ issue_type= IssueType.precondition_not_met
; description= desc
; ocaml_pos= Some ocaml_pos
; visibility= Exn_developer
; severity= Some Warning
; category= Nocat }
; severity= Some Warning }
(* always a warning *)
| Retain_cycle (desc, ocaml_pos) ->
{ issue_type= IssueType.retain_cycle
; description= desc
; ocaml_pos= Some ocaml_pos
; visibility= Exn_user
; severity= None
; category= Prover }
; severity= None }
| Registered_observer_being_deallocated (desc, ocaml_pos) ->
{ issue_type= IssueType.biabd_registered_observer_being_deallocated
; description= desc
; ocaml_pos= Some ocaml_pos
; visibility= Exn_user
; severity= Some Error
; category= Nocat }
; severity= Some Error }
| Stack_variable_address_escape (desc, ocaml_pos) ->
{ issue_type= IssueType.biabd_stack_variable_address_escape
; description= desc
; ocaml_pos= Some ocaml_pos
; visibility= Exn_user
; severity= Some Error
; category= Nocat }
; severity= Some Error }
| SymOp.Analysis_failure_exe _ ->
{ issue_type= IssueType.failure_exe
; description= Localise.no_desc
; ocaml_pos= None
; visibility= Exn_system
; severity= None
; category= Nocat }
; severity= None }
| Skip_function desc ->
{ issue_type= IssueType.skip_function
; description= desc
; ocaml_pos= None
; visibility= Exn_developer
; severity= None
; category= Nocat }
; severity= None }
| Skip_pointer_dereference (desc, ocaml_pos) ->
{ issue_type= IssueType.skip_pointer_dereference
; description= desc
; ocaml_pos= Some ocaml_pos
; visibility= Exn_user
; severity= Some Info
; category= Nocat }
; severity= Some Info }
(* always an info *)
| Symexec_memory_error ocaml_pos ->
{ issue_type= IssueType.symexec_memory_error
; description= Localise.no_desc
; ocaml_pos= Some ocaml_pos
; visibility= Exn_developer
; severity= None
; category= Nocat }
; severity= None }
| Unary_minus_applied_to_unsigned_expression (desc, ocaml_pos) ->
{ issue_type= IssueType.unary_minus_applied_to_unsigned_expression
; description= desc
; ocaml_pos= Some ocaml_pos
; visibility= Exn_user
; severity= None
; category= Nocat }
; severity= None }
| Wrong_argument_number ocaml_pos ->
{ issue_type= IssueType.wrong_argument_number
; description= Localise.no_desc
; ocaml_pos= Some ocaml_pos
; visibility= Exn_developer
; severity= None
; category= Nocat }
; severity= None }
| exn ->
{ issue_type= IssueType.failure_exe
; description=
Localise.verbatim_desc (F.asprintf "%a: %s" Exn.pp exn (Caml.Printexc.get_backtrace ()))
; ocaml_pos= None
; visibility= Exn_system
; severity= None
; category= Nocat }
; severity= None }
(** print a description of the exception to the html output *)

@ -24,11 +24,6 @@ type severity = Like | Info | Advice | Warning | Error [@@deriving compare]
val equal_severity : severity -> severity -> bool
(** class of error *)
type err_class = Checker | Prover | Nocat | Linters
val equal_err_class : err_class -> err_class -> bool
exception Abduction_case_not_implemented of Logging.ocaml_pos
exception Analysis_stops of Localise.error_desc * Logging.ocaml_pos option
@ -141,7 +136,6 @@ type t =
; description: Localise.error_desc
; ocaml_pos: Logging.ocaml_pos option (** location in the infer source code *)
; visibility: visibility
; severity: severity option
; category: err_class }
; severity: severity option }
val recognize_exception : exn -> t

@ -59,8 +59,8 @@ let loc_trace_to_jsonbug_record trace_list ekind =
record_list
let should_report issue_type error_desc eclass =
if (not Config.filtering) || Exceptions.equal_err_class eclass Exceptions.Linters then true
let should_report issue_type error_desc =
if not Config.filtering then true
else
let issue_type_is_null_deref =
let null_deref_issue_types =
@ -166,7 +166,7 @@ module JsonIssuePrinter = MakeJsonListPrinter (struct
if
error_filter source_file err_key.issue_type
&& should_report_source_file
&& should_report err_key.issue_type err_key.err_desc err_data.err_class
&& should_report err_key.issue_type err_key.err_desc
then
let severity = Exceptions.severity_string err_key.severity in
let bug_type = err_key.issue_type.unique_id in

Loading…
Cancel
Save