fix stuff that was accidentally broken

Reviewed By: martinoluca

Differential Revision: D2647203

fb-gh-sync-id: b1d3b78
master
Jules Villard 9 years ago committed by facebook-github-bot-1
parent 0490e739b0
commit d545da14c1

@ -6,11 +6,12 @@
# of patent rights can be found in the PATENTS file in the same directory. # of patent rights can be found in the PATENTS file in the same directory.
import argparse import argparse
import json
import logging
import os import os
import subprocess import subprocess
import traceback import traceback
import util import util
import logging
from inferlib import utils from inferlib import utils
@ -93,7 +94,8 @@ class BuckAnalyzer:
) )
args = [ args = [
'--config', '--config',
'infer.infer_bin={bin}'.format(bin=utils.get_infer_bin()), 'infer.infer_bin={bin}'
.format(bin=utils.BIN_DIRECTORY),
'--config', '--config',
'infer.clang_compiler={clang}'.format(clang=clang_path), 'infer.clang_compiler={clang}'.format(clang=clang_path),
'--config', '--config',
@ -134,11 +136,11 @@ class BuckAnalyzer:
if not ret == os.EX_OK: if not ret == os.EX_OK:
return ret return ret
result_files = self._get_analysis_result_files() result_files = self._get_analysis_result_files()
merged_results_path = \ all_results = utils.merge_json_arrays_from_files(result_files)
os.path.join(self.args.infer_out, utils.JSON_REPORT_FILENAME) merged_results_path = os.path.join(self.args.infer_out,
utils.merge_json_reports( utils.JSON_REPORT_FILENAME)
result_files, with open(merged_results_path, 'w') as file_out:
merged_results_path) json.dump(all_results, file_out, indent=2)
# TODO: adapt issues.print_errors to support json and print on screen # TODO: adapt issues.print_errors to support json and print on screen
print('Results saved in {results_path}'.format( print('Results saved in {results_path}'.format(
results_path=merged_results_path)) results_path=merged_results_path))

@ -95,7 +95,7 @@ def clean_json(args, json_report):
cmp=_compare_json_rows) cmp=_compare_json_rows)
temporary_file = tempfile.mktemp() temporary_file = tempfile.mktemp()
with open(temporary_file, 'w') as file_out: with open(temporary_file, 'w') as file_out:
json.dump(collected_rows, file_out) json.dump(collected_rows, file_out, indent=2)
file_out.flush() file_out.flush()
shutil.move(temporary_file, json_report) shutil.move(temporary_file, json_report)

@ -201,9 +201,13 @@ def run_command(cmd, debug_mode, infer_out, message, env=os.environ):
raise e raise e
def print_exit(s): def merge_json_arrays_from_files(report_paths):
print(s) # TODO: use streams instead of loading the entire json in memory
exit(os.EX_OK) json_data = []
for json_path in report_paths:
with codecs.open(json_path, 'r', encoding=config.LOCALE) as fd:
json_data = json_data + json.loads(fd.read())
return json_data
def infer_version(): def infer_version():

Loading…
Cancel
Save