Indent json files

Summary:
The json files that were written by json.dump were valid, machine readable but they had no indentation/return lines making them a long single line and hard to read. Dump the json with an indent of
2.
Closes https://github.com/facebook/infer/pull/149
Github Author: =?UTF-8?q?Deniz=20T=C3=BCrkoglu?= <deniz@spotify.com>
master
=?UTF-8?q?Deniz=20T=C3=BCrkoglu?= 9 years ago
parent 902e5afa61
commit 2b8e8dec7f

@ -440,7 +440,7 @@ def collect_results(args, start_time):
stats_filename = os.path.join(args.infer_out, utils.STATS_FILENAME)
with open(stats_filename, 'w') as stats_out:
json.dump(stats, stats_out)
json.dump(stats, stats_out, indent=2)
basic_stats = get_basic_stats(stats)

@ -629,7 +629,7 @@ class Infer:
self.stats['normal']['infer_version'] = utils.infer_version()
with open(stats_path, 'w') as stats_file:
json.dump(self.stats, stats_file)
json.dump(self.stats, stats_file, indent=2)
def close(self):
if self.args.analyzer != COMPILE:

@ -348,8 +348,8 @@ def create_json_report(out_dir):
rows = [row for row in reader]
with open(json_report_filename, 'w') as file_out:
headers = rows[0]
issues = rows[1:]
json.dump([dict(zip(headers, row)) for row in issues], file_out)
issues = [dict(zip(headers, row)) for row in rows[1:]]
json.dump(issues, file_out, indent=2)
class AbsolutePathAction(argparse.Action):

Loading…
Cancel
Save