From ef556e048e9f32a4d9342faeea45afa2684388e7 Mon Sep 17 00:00:00 2001 From: Jeremy Dubreil Date: Mon, 23 Oct 2017 23:03:53 -0700 Subject: [PATCH] [infer][java] for the Buck integration, simply concatenate the lists of bugs found on every target Summary: Saving the list of bugs in a set removes the ordering. Also, there should be no need to remove the duplicated warnings at this level. Reviewed By: sblackshear Differential Revision: D6060554 fbshipit-source-id: a78d35d --- infer/lib/python/inferlib/bucklib.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/infer/lib/python/inferlib/bucklib.py b/infer/lib/python/inferlib/bucklib.py index c753776c0..87955ad1d 100644 --- a/infer/lib/python/inferlib/bucklib.py +++ b/infer/lib/python/inferlib/bucklib.py @@ -146,14 +146,14 @@ def collect_results(args, start_time, targets): """Walks through buck-out/, collects results for the different buck targets and stores them in in args.infer_out/results.json. """ - all_json_rows = set() + all_json_rows = [] for path in get_output_jars(targets): try: with zipfile.ZipFile(path) as jar: json_rows = load_json_report(jar) for row in json_rows: - all_json_rows.add(json.dumps(row)) + all_json_rows.append(row) except NotFoundInJar: pass except zipfile.BadZipfile: @@ -161,12 +161,8 @@ def collect_results(args, start_time, targets): json_report = os.path.join(args.infer_out, config.JSON_REPORT_FILENAME) - with open(json_report, 'w') as report: - json_string = '[' - json_string += ','.join(all_json_rows) - json_string += ']' - report.write(json_string) - report.flush() + with open(json_report, 'w') as file_out: + json.dump(all_json_rows, file_out) bugs_out = os.path.join(args.infer_out, config.BUGS_FILENAME) issues.print_and_save_errors(args.infer_out, args.project_root,