[cli] do not regenerate report.json when printing specs to stdout

Summary:
Running `infer report foo.specs` would overwrite report.json with an empty json.

Only recompute report.json when running `infer-analyze` or `infer-run`.

Reviewed By: mbouaziz

Differential Revision: D5963500

fbshipit-source-id: e579c6f
master
Jules Villard 7 years ago committed by Facebook Github Bot
parent f3d98eb807
commit 65a53a0c63

@ -1046,8 +1046,8 @@ let mk_format format_kind fname =
let init_issues_format_list report_csv report_json =
let csv_format = Option.value_map ~f:(mk_format Csv) ~default:[] report_csv in
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.bugs_tests in
let txt_format = Option.value_map ~f:(mk_format Text) ~default:[] Config.bugs_txt 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
csv_format @ json_format @ tests_format @ txt_format
let init_procs_format_list () = Option.value_map ~f:(mk_format Csv) ~default:[] Config.procs_csv

@ -77,16 +77,7 @@ let () =
if Config.developer_mode then InferAnalyze.register_perf_stats_report () ;
Driver.analyze_and_report Analyze ~changed_files:(Driver.read_config_changed_files ())
| Report
-> let report_json =
match Config.from_json_report with
| None
-> Some Config.(results_dir ^/ report_json)
| Some _
-> (* if we start from a json report instead of the specs, do not generate a json report
again *)
None
in
InferPrint.main ~report_csv:Config.bugs_csv ~report_json
-> InferPrint.main ~report_csv:Config.issues_csv ~report_json:None
| ReportDiff
-> (* at least one report must be passed in input to compute differential *)
( match (Config.report_current, Config.report_previous) with

@ -738,21 +738,6 @@ and buck_out =
~in_help:CLOpt.([(Capture, manual_buck_java)])
~meta:"dir" "Specify the root directory of buck-out"
and bugs_csv =
CLOpt.mk_path_opt ~deprecated:["bugs"] ~long:"issues-csv"
~in_help:CLOpt.([(Report, manual_generic)])
~meta:"file" "Write a list of issues in CSV format to $(i,file)"
and bugs_tests =
CLOpt.mk_path_opt ~long:"issues-tests"
~in_help:CLOpt.([(Report, manual_generic)])
~meta:"file" "Write a list of issues in a format suitable for tests to $(i,file)"
and bugs_txt =
CLOpt.mk_path_opt ~deprecated:["bugs_txt"] ~long:"issues-txt"
~in_help:CLOpt.([(Report, manual_generic)])
~meta:"file" "Write a list of issues in text format to $(i,file) (default: infer-out/bugs.txt)"
and calls_csv =
CLOpt.mk_path_opt ~deprecated:["calls"] ~long:"calls-csv"
~in_help:CLOpt.([(Report, manual_generic)])
@ -1178,6 +1163,11 @@ and iphoneos_target_sdk_version_path_regex =
~in_help:CLOpt.([(Capture, manual_clang_linters)])
"To pass a specific target SDK version to use for iphoneos in a particular path, with the format path:version (can be specified multiple times)"
and issues_csv =
CLOpt.mk_path_opt ~deprecated:["bugs"] ~long:"issues-csv"
~in_help:CLOpt.([(Report, manual_generic)])
~meta:"file" "Write a list of issues in CSV format to $(i,file)"
and issues_fields =
CLOpt.mk_symbol_seq ~long:"issues-fields"
~in_help:CLOpt.([(Report, manual_generic)])
@ -1189,6 +1179,16 @@ and issues_fields =
; `Issue_field_bug_trace ] ~symbols:issues_fields_symbols ~eq:PVariant.( = )
"Fields to emit with $(b,--issues-tests)"
and issues_tests =
CLOpt.mk_path_opt ~long:"issues-tests"
~in_help:CLOpt.([(Report, manual_generic)])
~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:CLOpt.([(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 symbolic operations and a multiple of seconds of elapsed time"
@ -1976,18 +1976,6 @@ and buck_out = !buck_out
and bufferoverrun = !bufferoverrun
and bugs_csv = !bugs_csv
and frontend_tests = !frontend_tests
and gen_previous_build_command_script = !gen_previous_build_command_script
and generated_classes = !generated_classes
and bugs_tests = !bugs_tests
and bugs_txt = !bugs_txt
and changed_files_index = !changed_files_index
and calls_csv = !calls_csv
@ -2080,6 +2068,12 @@ and from_json_report = !from_json_report
and frontend_stats = !frontend_stats
and frontend_tests = !frontend_tests
and gen_previous_build_command_script = !gen_previous_build_command_script
and generated_classes = !generated_classes
and headers = !headers
and html = !html
@ -2097,8 +2091,14 @@ and iphoneos_target_sdk_version = !iphoneos_target_sdk_version
and iphoneos_target_sdk_version_path_regex =
process_iphoneos_target_sdk_version_path_regex !iphoneos_target_sdk_version_path_regex
and issues_csv = !issues_csv
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

@ -299,12 +299,6 @@ val buck_out : string option
val bufferoverrun : bool
val bugs_csv : string option
val bugs_tests : string option
val bugs_txt : string option
val changed_files_index : string option
val calls_csv : string option
@ -436,6 +430,8 @@ type iphoneos_target_sdk_version_path_regex = {path: Str.regexp; version: string
val iphoneos_target_sdk_version_path_regex : iphoneos_target_sdk_version_path_regex list
val issues_csv : string option
val issues_fields :
[ `Issue_field_bug_class
| `Issue_field_kind
@ -457,6 +453,10 @@ val issues_fields :
| `Issue_field_qualifier_contains_potential_exception_note ]
list
val issues_tests : string option
val issues_txt : string option
val iterations : int
val java_jar_compiler : string option

@ -395,7 +395,7 @@ let report ?(suppress_console= false) () =
| false, Some prog
-> let if_some key opt args = match opt with None -> args | Some arg -> key :: arg :: args in
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.bugs_txt in
let bugs_txt = Option.value ~default:(Config.results_dir ^/ "bugs.txt") Config.issues_txt in
let args =
if_some "--issues-csv" report_csv @@ if_true "--pmd-xml" Config.pmd_xml
@@ if_true "--quiet" (Config.quiet || suppress_console)

Loading…
Cancel
Save