From c27e4c72a47f0bbd6b4089899ed2c92c1769f77e Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Wed, 11 Mar 2020 04:52:28 -0700 Subject: [PATCH] [config] delete --issues-txt option Summary: InferPrint hasn't been in charge of writing bugs.txt since forever. This will be re-implemented as a post-processing of report.json instead (like it is now, but in OCaml instead of python). Reviewed By: ngorogiannis Differential Revision: D20362641 fbshipit-source-id: 83d8cb53d --- infer/man/man1/infer-full.txt | 7 ----- infer/man/man1/infer-report.txt | 4 --- infer/man/man1/infer.txt | 4 --- infer/src/backend/InferPrint.ml | 51 ++++----------------------------- infer/src/base/Config.ml | 8 ------ infer/src/base/Config.mli | 2 -- infer/src/integration/Driver.ml | 2 +- 7 files changed, 7 insertions(+), 71 deletions(-) diff --git a/infer/man/man1/infer-full.txt b/infer/man/man1/infer-full.txt index 6b2706629..c1ac48e57 100644 --- a/infer/man/man1/infer-full.txt +++ b/infer/man/man1/infer-full.txt @@ -665,10 +665,6 @@ OPTIONS Write a list of issues in a format suitable for tests to file See also infer-report(1). - --issues-txt file - Write a list of issues in text format to file (default: - infer-out/bugs.txt) See also infer-report(1). - --java-jar-compiler path Specify the Java compiler jar used to generate the bytecode See also infer-capture(1). @@ -1427,9 +1423,6 @@ INTERNAL OPTIONS --issues-tests-reset Cancel the effect of --issues-tests. - --issues-txt-reset - Cancel the effect of --issues-txt. - --iterations int Specify the maximum number of operations for each function, expressed as a multiple of symbolic operations and a multiple of diff --git a/infer/man/man1/infer-report.txt b/infer/man/man1/infer-report.txt index 3fc369d9d..bf124a678 100644 --- a/infer/man/man1/infer-report.txt +++ b/infer/man/man1/infer-report.txt @@ -283,10 +283,6 @@ OPTIONS --issues-tests file Write a list of issues in a format suitable for tests to file - --issues-txt file - Write a list of issues in text format to file (default: - infer-out/bugs.txt) - --print-logs Activates: Also log messages to stdout and stderr (Conversely: --no-print-logs) diff --git a/infer/man/man1/infer.txt b/infer/man/man1/infer.txt index 980031a53..046c11b71 100644 --- a/infer/man/man1/infer.txt +++ b/infer/man/man1/infer.txt @@ -665,10 +665,6 @@ OPTIONS Write a list of issues in a format suitable for tests to file See also infer-report(1). - --issues-txt file - Write a list of issues in text format to file (default: - infer-out/bugs.txt) See also infer-report(1). - --java-jar-compiler path Specify the Java compiler jar used to generate the bytecode See also infer-capture(1). diff --git a/infer/src/backend/InferPrint.ml b/infer/src/backend/InferPrint.ml index 0bc5482fc..74079986d 100644 --- a/infer/src/backend/InferPrint.ml +++ b/infer/src/backend/InferPrint.ml @@ -343,35 +343,6 @@ let tests_jsonbug_compare (bug1 : Jsonbug_t.jsonbug) (bug2 : Jsonbug_t.jsonbug) (bug2.file, bug2.procedure, bug2.line - bug2.procedure_start_line, bug2.bug_type, bug2.hash) -module IssuesTxt = struct - let pp_issue fmt error_filter proc_loc_opt (key : Errlog.err_key) (err_data : Errlog.err_data) = - let source_file = - match proc_loc_opt with - | Some proc_loc -> - proc_loc.Location.file - | None -> - err_data.loc.Location.file - in - if - error_filter source_file key.err_name - && ((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 () - - - (** Write bug report in text format *) - let pp_issues_of_error_log fmt error_filter _ proc_loc_opt _ err_log = - Errlog.iter (pp_issue fmt error_filter proc_loc_opt) err_log -end - -let pp_text_of_report fmt report = - let pp_row jsonbug = - let open Jsonbug_t in - F.fprintf fmt "%s:%d: %s: %s %s@\n" jsonbug.file jsonbug.line jsonbug.severity jsonbug.bug_type - jsonbug.qualifier - in - List.iter ~f:pp_row report ; F.fprintf fmt "@?" - - let error_filter filters proc_name file error_name = (Config.write_html || not (IssueType.(equal skip_function) error_name)) && filters.Inferconfig.path_filter file @@ -381,7 +352,7 @@ let error_filter filters proc_name file error_name = type report_kind = Costs | Issues | Summary [@@deriving compare] -type bug_format_kind = Json | Tests | Text [@@deriving compare] +type bug_format_kind = Json | Tests [@@deriving compare] let get_outfile outfile = match outfile with @@ -400,9 +371,6 @@ let pp_issue_in_format (format_kind, (outfile_opt : Utils.outfile option)) error {error_filter; proc_name; proc_loc_opt= Some proc_location; err_key; err_data} | Tests -> L.die InternalError "Printing issues as tests is not implemented" - | Text -> - let outf = get_outfile outfile_opt in - IssuesTxt.pp_issue outf.fmt error_filter (Some proc_location) err_key err_data let pp_issues_in_format (format_kind, (outfile_opt : Utils.outfile option)) = @@ -412,9 +380,6 @@ let pp_issues_in_format (format_kind, (outfile_opt : Utils.outfile option)) = IssuesJson.pp_issues_of_error_log outf.fmt | Tests -> L.die InternalError "Printing issues as tests is not implemented" - | Text -> - let outf = get_outfile outfile_opt in - IssuesTxt.pp_issues_of_error_log outf.fmt let pp_issues_of_error_log error_filter linereader proc_loc_opt procname err_log bug_format_list = @@ -443,8 +408,8 @@ let pp_costs_in_format (format_kind, (outfile_opt : Utils.outfile option)) = | Json -> let outf = get_outfile outfile_opt in JsonCostsPrinter.pp outf.fmt - | Tests | Text -> - L.(die InternalError) "Printing costs in tests/text/logs is not implemented" + | Tests -> + L.die InternalError "Printing costs in tests is not implemented" let pp_costs summary costs_format_list = @@ -480,9 +445,6 @@ let pp_json_report_by_report_kind formats_by_report_kind fname = | Tests -> let outf = get_outfile outfile_opt in pp_custom_of_report outf.fmt report Config.issues_fields - | Text -> - let outf = get_outfile outfile_opt in - pp_text_of_report outf.fmt report | Json -> L.die InternalError "Printing issues from json does not support json output" in @@ -538,8 +500,7 @@ let mk_format format_kind fname = let init_issues_format_list report_json = let json_format = Option.value_map ~f:(mk_format Json) ~default:[] report_json in let tests_format = Option.value_map ~f:(mk_format Tests) ~default:[] Config.issues_tests in - let txt_format = Option.value_map ~f:(mk_format Text) ~default:[] Config.issues_txt in - json_format @ tests_format @ txt_format + json_format @ tests_format let init_files format_list_by_kind = @@ -552,7 +513,7 @@ let init_files format_list_by_kind = | Json, Issues -> let outfile = get_outfile outfile_opt in IssuesJson.pp_open outfile.fmt () - | Json, Summary | Tests, _ | Text, _ -> + | Json, Summary | Tests, _ -> () in List.iter ~f:init_files_of_format format_list @@ -570,7 +531,7 @@ let finalize_and_close_files format_list_by_kind = | Json, Issues -> let outfile = get_outfile outfile_opt in IssuesJson.pp_close outfile.fmt () - | Json, Summary | Tests, _ | Text, _ -> + | Json, Summary | Tests, _ -> () ) ; match outfile_opt with Some outfile -> Utils.close_outf outfile | None -> () in diff --git a/infer/src/base/Config.ml b/infer/src/base/Config.ml index 4e3f26a0d..496c6a28b 100644 --- a/infer/src/base/Config.ml +++ b/infer/src/base/Config.ml @@ -1455,12 +1455,6 @@ and issues_tests = ~meta:"file" "Write a list of issues in a format suitable for tests to $(i,file)" -and issues_txt = - CLOpt.mk_path_opt ~deprecated:["bugs_txt"] ~long:"issues-txt" - ~in_help:InferCommand.[(Report, manual_generic)] - ~meta:"file" "Write a list of issues in text format to $(i,file) (default: infer-out/bugs.txt)" - - and iterations = CLOpt.mk_int ~deprecated:["iterations"] ~long:"iterations" ~default:1 ~meta:"int" "Specify the maximum number of operations for each function, expressed as a multiple of \ @@ -2793,8 +2787,6 @@ and issues_fields = !issues_fields and issues_tests = !issues_tests -and issues_txt = !issues_txt - and iterations = !iterations and java_jar_compiler = !java_jar_compiler diff --git a/infer/src/base/Config.mli b/infer/src/base/Config.mli index 3acb81f59..d6e488ff1 100644 --- a/infer/src/base/Config.mli +++ b/infer/src/base/Config.mli @@ -404,8 +404,6 @@ val issues_fields : val issues_tests : string option -val issues_txt : string option - val iterations : int val java_jar_compiler : string option diff --git a/infer/src/integration/Driver.ml b/infer/src/integration/Driver.ml index c3dfb5f7a..3b6aa94e5 100644 --- a/infer/src/integration/Driver.ml +++ b/infer/src/integration/Driver.ml @@ -331,7 +331,7 @@ let report ?(suppress_console = false) () = () | false, Some prog -> let if_true key opt args = if not opt then args else key :: args in - let bugs_txt = Option.value ~default:(Config.results_dir ^/ "bugs.txt") Config.issues_txt in + let bugs_txt = Config.results_dir ^/ "bugs.txt" in let args = if_true "--pmd-xml" Config.pmd_xml @@ if_true "--quiet"