From 5b76bb876f0cb529f517e7322e2200535d4781db Mon Sep 17 00:00:00 2001 From: Jeremy Dubreil Date: Mon, 29 Apr 2019 16:01:21 -0700 Subject: [PATCH] [infer] make the censor reason an option field in the analysis report Reviewed By: mbouaziz Differential Revision: D15077671 fbshipit-source-id: 5a22429f9 --- infer/src/atd/jsonbug.atd | 2 +- infer/src/backend/InferPrint.ml | 4 ++-- infer/src/backend/InferPrint.mli | 2 +- infer/src/unit/DifferentialTestsUtils.ml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/infer/src/atd/jsonbug.atd b/infer/src/atd/jsonbug.atd index be65e96e7..4eb33d6b8 100644 --- a/infer/src/atd/jsonbug.atd +++ b/infer/src/atd/jsonbug.atd @@ -44,7 +44,7 @@ type jsonbug = { bug_type_hum: string; ?linters_def_file: string option; ?traceview_id: int option; - censored_reason : string; + ?censored_reason : string option; ?access : string option; ?extras : extra option; } diff --git a/infer/src/backend/InferPrint.ml b/infer/src/backend/InferPrint.ml index b308211d5..165c8cda6 100644 --- a/infer/src/backend/InferPrint.ml +++ b/infer/src/backend/InferPrint.ml @@ -193,7 +193,7 @@ let censored_reason (issue_type : IssueType.t) source_file = in Option.some_if (not accepted) reason in - Option.value ~default:"" (List.find_map Config.filter_report ~f:rejected_by) + List.find_map Config.filter_report ~f:rejected_by let potential_exception_message = "potential exception at line" @@ -449,7 +449,7 @@ module IssuesTxt = struct in if error_filter source_file key.err_name - && ((not Config.filtering) || String.is_empty (censored_reason key.err_name source_file)) + && ((not Config.filtering) || Option.is_none (censored_reason key.err_name source_file)) then Exceptions.pp_err err_data.loc key.severity key.err_name key.err_desc None fmt () diff --git a/infer/src/backend/InferPrint.mli b/infer/src/backend/InferPrint.mli index 21b6a26e1..87d078e5b 100644 --- a/infer/src/backend/InferPrint.mli +++ b/infer/src/backend/InferPrint.mli @@ -10,6 +10,6 @@ open! IStd val loc_trace_to_jsonbug_record : Errlog.loc_trace_elem list -> Exceptions.severity -> Jsonbug_t.json_trace_item list -val censored_reason : IssueType.t -> SourceFile.t -> string +val censored_reason : IssueType.t -> SourceFile.t -> string option val main : report_json:string option -> unit diff --git a/infer/src/unit/DifferentialTestsUtils.ml b/infer/src/unit/DifferentialTestsUtils.ml index 0eeb2674d..0c8374a04 100644 --- a/infer/src/unit/DifferentialTestsUtils.ml +++ b/infer/src/unit/DifferentialTestsUtils.ml @@ -31,7 +31,7 @@ let create_fake_jsonbug ?(bug_type = "bug_type") ?(qualifier = "qualifier") ; linters_def_file ; doc_url ; traceview_id= None - ; censored_reason= "" + ; censored_reason= None ; access= None ; extras= None }