Always collect the statistics and create a report file for Buck projects, even when the target contains no Java source code

Summary: It is preferable to always create error reports as a proof of succesful termination, even when the Buck target contains no source file to analyze

Reviewed By: sblackshear, jvillard

Differential Revision: D3362581

fbshipit-source-id: 4f27666
master
Jeremy Dubreil 9 years ago committed by Facebook Github Bot 3
parent 08c1c5bbf0
commit 6d37b5ee6d

@ -171,6 +171,7 @@ def store_performances_csv(infer_out, stats):
flat_stats = dict(int_stats + normal_stats)
values = []
for key in keys:
if key in flat_stats:
values.append(flat_stats[key])
csv_writer.writerow(keys)
csv_writer.writerow(values)
@ -190,13 +191,13 @@ def get_harness_code():
def get_basic_stats(stats):
files_analyzed = '{0} files ({1} lines) analyzed in {2}s\n\n'.format(
stats['int']['files'],
stats['int']['lines'],
stats['int'].get('files', 0),
stats['int'].get('lines', 0),
stats['int']['total_time'],
)
phase_times = 'Capture time: {0}s\nAnalysis time: {1}s\n\n'.format(
stats['int']['capture_time'],
stats['int']['analysis_time'],
stats['int'].get('capture_time', 0),
stats['int'].get('analysis_time', 0),
)
to_skip = {
@ -344,12 +345,7 @@ def collect_results(args, start_time):
json_report = os.path.join(args.infer_out, config.JSON_REPORT_FILENAME)
bugs_out = os.path.join(args.infer_out, config.BUGS_FILENAME)
if len(headers) == 0:
with open(csv_report, 'w'):
pass
logging.info('No reports found')
return
elif len(headers) > 1:
if len(headers) > 1:
if any(map(lambda x: x != headers[0], headers)):
raise Exception('Inconsistent reports found')
@ -361,6 +357,7 @@ def collect_results(args, start_time):
del(stats['float'])
with open(csv_report, 'w') as report:
if len(headers) > 0:
writer = csv.writer(report)
all_csv_rows = [list(row) for row in all_csv_rows]
writer.writerows([headers[0]] + all_csv_rows)
@ -475,7 +472,7 @@ class Wrapper:
if len(self.normalized_targets) == 0:
logging.info('Nothing to analyze')
else:
self.timer.start('Running buck...')
self.timer.start('Running Buck ...')
javac_config = ['--config', 'tools.javac=' + infer_script]
buck_cmd = self.buck_cmd + javac_config
subprocess.check_call(buck_cmd)

Loading…
Cancel
Save