diff --git a/infer/lib/python/inferlib/analyze.py b/infer/lib/python/inferlib/analyze.py index 1856bc5c2..6fb1fb0d0 100644 --- a/infer/lib/python/inferlib/analyze.py +++ b/infer/lib/python/inferlib/analyze.py @@ -38,6 +38,10 @@ base_group.add_argument('--debug-exceptions', action='store_true', just print the internal exceptions during analysis''') base_group.add_argument('-g', '--debug', action='store_true', help='Generate all debugging information') +base_group.add_argument('--disable-bug-list', action='store_true', + help='''Disable the creation of the human readable list + of issues found. Useful for CI integration when only + the JSON report is used''') base_group.add_argument('-a', '--analyzer', help='Select the analyzer within: {0}'.format( ', '.join(config.ANALYZERS)), diff --git a/infer/lib/python/inferlib/bucklib.py b/infer/lib/python/inferlib/bucklib.py index f016ddbed..6920cb4fa 100644 --- a/infer/lib/python/inferlib/bucklib.py +++ b/infer/lib/python/inferlib/bucklib.py @@ -163,11 +163,12 @@ def collect_results(args, start_time, targets): report.write(json_string) report.flush() - bugs_out = os.path.join(args.infer_out, config.BUGS_FILENAME) - issues.print_and_save_errors(args.infer_out, args.project_root, - json_report, bugs_out, args.pmd_xml) - shutil.copy(bugs_out, os.path.join(args.infer_out, - ANALYSIS_SUMMARY_OUTPUT)) + if not args.disable_bug_list: + bugs_out = os.path.join(args.infer_out, config.BUGS_FILENAME) + issues.print_and_save_errors(args.infer_out, args.project_root, + json_report, bugs_out, args.pmd_xml) + shutil.copy(bugs_out, os.path.join(args.infer_out, + ANALYSIS_SUMMARY_OUTPUT)) def cleanup(temp_files): diff --git a/infer/src/backend/infer.ml b/infer/src/backend/infer.ml index 11656d65d..e13b2795f 100644 --- a/infer/src/backend/infer.ml +++ b/infer/src/backend/infer.ml @@ -242,6 +242,8 @@ let capture = function ["--debug"]) @ (if not Config.debug_exceptions then [] else ["--debug-exceptions"]) @ + (if not Config.disable_bug_list then [] else + ["--disable-bug-list"]) @ (if Config.filtering then [] else ["--no-filtering"]) @ (if not Config.flavors || not in_buck_mode then [] else diff --git a/infer/src/base/Config.ml b/infer/src/base/Config.ml index 43b9525ce..555769615 100644 --- a/infer/src/base/Config.ml +++ b/infer/src/base/Config.ml @@ -827,6 +827,12 @@ and dependencies = "Translate all the dependencies during the capture. The classes in the given jar file will be \ translated. No sources needed." +and disable_bug_list = + CLOpt.mk_bool ~long:"disable-bug-list" + ~parse_mode:CLOpt.(Infer [Driver]) + "Disable the creation of the human readable list of issues found. \ + Useful for CI integration when only the JSON report is used" + and disable_checks = CLOpt.mk_string_list ~deprecated:["disable_checks"] ~long:"disable-checks" ~meta:"error name" ~parse_mode:CLOpt.(Infer [Driver;Print]) @@ -1580,6 +1586,7 @@ and debug_mode = !debug and debug_exceptions = !debug_exceptions and dependency_mode = !dependencies and developer_mode = !developer_mode +and disable_bug_list = !disable_bug_list and disable_checks = !disable_checks and dotty_cfg_libs = !dotty_cfg_libs and enable_checks = !enable_checks diff --git a/infer/src/base/Config.mli b/infer/src/base/Config.mli index da60b9da4..4882eaceb 100644 --- a/infer/src/base/Config.mli +++ b/infer/src/base/Config.mli @@ -207,6 +207,7 @@ val debug_mode : bool val debug_exceptions : bool val dependency_mode : bool val developer_mode : bool +val disable_bug_list : bool val disable_checks : string list val dotty_cfg_libs : bool val dynamic_dispatch : [ `None | `Interface | `Sound | `Lazy ]