diff --git a/infer/src/backend/InferPrint.re b/infer/src/backend/InferPrint.re index 81c4d31fb..4cd133eaa 100644 --- a/infer/src/backend/InferPrint.re +++ b/infer/src/backend/InferPrint.re @@ -1368,7 +1368,8 @@ let register_perf_stats_report () => { PerfStats.register_report_at_exit stats_file }; -let mk_format format_kind out_file => [(format_kind, out_file)]; +let mk_format format_kind fname => + Option.map_default (fun out_file => [(format_kind, out_file)]) [] (create_outfile fname); let init_issues_format_list () => { let csv_format = Option.map_default (mk_format Csv) [] Config.bugs_csv; diff --git a/infer/src/base/Config.ml b/infer/src/base/Config.ml index d4fe81fd2..d4ff34ac3 100644 --- a/infer/src/base/Config.ml +++ b/infer/src/base/Config.ml @@ -612,34 +612,38 @@ and buck_out = ~exes:CLOpt.[StatsAggregator] ~meta:"dir" "Specify the root directory of buck-out" and bugs_csv = - CLOpt.mk_option ~deprecated:["bugs"] ~long:"issues-csv" ~f:create_outfile - ~exes:CLOpt.[Print] - ~meta:"file" "Create a file containing a list of issues in CSV format" + CLOpt.mk_string_opt ~deprecated:["bugs"] ~long:"issues-csv" + ~exes:CLOpt.[Toplevel;Print] + ~meta:"file" "Write a list of issues in CSV format to a file" and bugs_json = - CLOpt.mk_option ~deprecated:["bugs_json"] ~long:"issues-json" ~f:create_outfile - ~exes:CLOpt.[Print] - ~meta:"file" "Create a file containing a list of issues in JSON format" + CLOpt.mk_string_opt ~deprecated:["bugs_json"] ~long:"issues-json" + ~exes:CLOpt.[Toplevel;Print] + ~meta:"file" "Write a list of issues in JSON format to a file" and bugs_tests = - CLOpt.mk_option ~long:"issues-tests" ~f:create_outfile - ~exes:CLOpt.[Print] - ~meta:"file" "Create a file containing issues in a format suitable for tests" + CLOpt.mk_string_opt ~long:"issues-tests" + ~exes:CLOpt.[Toplevel;Print] + ~meta:"file" + "Write a list of issues in a format suitable for tests to a file" and bugs_txt = - CLOpt.mk_option ~deprecated:["bugs_txt"] ~long:"issues-txt" ~f:create_outfile - ~exes:CLOpt.[Print] - ~meta:"file" "Create a file containing a list of issues in TXT format" + CLOpt.mk_string_opt ~deprecated:["bugs_txt"] ~long:"issues-txt" + ~exes:CLOpt.[Toplevel;Print] + ~meta:"file" + "Write a list of issues in TXT format to a file" and bugs_xml = - CLOpt.mk_option ~deprecated:["bugs_xml"] ~long:"issues-xml" ~f:create_outfile - ~exes:CLOpt.[Print] - ~meta:"file" "Create a file containing a list of issues in XML format" + CLOpt.mk_string_opt ~deprecated:["bugs_xml"] ~long:"issues-xml" + ~exes:CLOpt.[Toplevel;Print] + ~meta:"file" + "Write a list of issues in XML format to a file" and calls_csv = - CLOpt.mk_option ~deprecated:["calls"] ~long:"calls-csv" ~f:create_outfile - ~exes:CLOpt.[Print] - ~meta:"file" "Write individual calls in csv format to a file" + CLOpt.mk_string_opt ~deprecated:["calls"] ~long:"calls-csv" + ~exes:CLOpt.[Toplevel;Print] + ~meta:"file" + "Write individual calls in CSV format to a file" and changed_files_index = CLOpt.mk_string_opt ~long:"changed-files-index" ~exes:CLOpt.[Toplevel] ~meta:"file" @@ -947,8 +951,9 @@ and join_cond = - 1 = use the least aggressive join for preconditions" and latex = - CLOpt.mk_option ~deprecated:["latex"] ~long:"latex" ~f:create_outfile - ~meta:"file" "Print latex report to a file" + CLOpt.mk_string_opt ~deprecated:["latex"] ~long:"latex" + ~meta:"file" + "Write a latex report of the analysis results to a file" and linters_def_file = CLOpt.mk_string_opt ~long:"linters-def-file" ~exes:CLOpt.[Clang] @@ -1061,12 +1066,14 @@ and print_using_diff = "Highlight the difference w.r.t. the previous prop when printing symbolic execution debug info" and procs_csv = - CLOpt.mk_option ~deprecated:["procs"] ~long:"procs-csv" ~f:create_outfile - ~meta:"file" "Create a file containing statistics for each procedure in CSV format" + CLOpt.mk_string_opt ~deprecated:["procs"] ~long:"procs-csv" + ~meta:"file" "Write statistics for each procedure in CSV format to a file" and procs_xml = - CLOpt.mk_option ~deprecated:["procs_xml"] ~long:"procs-xml" ~f:create_outfile - ~meta:"file" "Create a file containing statistics for each procedure in XML format" + CLOpt.mk_string_opt ~deprecated:["procs_xml"] ~long:"procs-xml" + ~meta:"file" + "Write statistics for each procedure in XML format to a file (as a path relative to \ + --results-dir)" and progress_bar = CLOpt.mk_bool ~deprecated_no:["no_progress_bar"] ~long:"progress-bar" ~short:"pb" ~default:true @@ -1083,8 +1090,8 @@ and reactive = "Reactive mode: the analysis starts from the files captured since the `infer` command started" and report = - CLOpt.mk_option ~deprecated:["report"] ~long:"report" ~f:create_outfile - ~meta:"file" "Create a file containing a report of the analysis results" + CLOpt.mk_string_opt ~deprecated:["report"] ~long:"report" + ~meta:"file" "Write a report of the analysis results to a file" and report_custom_error = CLOpt.mk_bool ~long:"report-custom-error" diff --git a/infer/src/base/Config.mli b/infer/src/base/Config.mli index f972b12d5..b8587d3a2 100644 --- a/infer/src/base/Config.mli +++ b/infer/src/base/Config.mli @@ -145,13 +145,13 @@ val blacklist : string option val buck : bool val buck_build_args : string list val buck_out : string option -val bugs_csv : outfile option -val bugs_json : outfile option -val bugs_tests : outfile option -val bugs_txt : outfile option -val bugs_xml : outfile option +val bugs_csv : string option +val bugs_json : string option +val bugs_tests : string option +val bugs_txt : string option +val bugs_xml : string option val changed_files_index : string option -val calls_csv : outfile option +val calls_csv : string option val check_duplicate_symbols : bool val checkers : bool val checkers_enabled : bool @@ -205,7 +205,7 @@ val java_jar_compiler : string option val javac_verbose_out : string val jobs : int val join_cond : int -val latex : outfile option +val latex : string option val linters_def_file : string option val load_analysis_results : string option val makefile_cmdline : string @@ -227,13 +227,13 @@ val precondition_stats : bool val print_builtins : bool val print_types : bool val print_using_diff : bool -val procs_csv : outfile option -val procs_xml : outfile option +val procs_csv : string option +val procs_xml : string option val project_root : string val quandary : bool val quiet : bool val reactive_mode : bool -val report : outfile option +val report : string option val report_runtime_exceptions : bool val reports_include_ml_loc : bool val results_dir : string