From b23eca2bbcafe9d890b8d7ab4482bb6db769a631 Mon Sep 17 00:00:00 2001 From: Jeremy Dubreil Date: Tue, 5 Dec 2017 22:02:55 -0800 Subject: [PATCH] [infer] remove file committed by mistake Reviewed By: sblackshear Differential Revision: D6475147 fbshipit-source-id: 66f6806 --- scripts/check_duplicates.py | 67 ------------------------------------- 1 file changed, 67 deletions(-) delete mode 100755 scripts/check_duplicates.py diff --git a/scripts/check_duplicates.py b/scripts/check_duplicates.py deleted file mode 100755 index 65f93d125..000000000 --- a/scripts/check_duplicates.py +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright (c) 2017 - present Facebook, Inc. -# All rights reserved. -# -# This source code is licensed under the BSD style license found in the -# LICENSE file in the root directory of this source tree. An additional grant -# of patent rights can be found in the PATENTS file in the same directory. - - -import json -import os -import sys - -REPORT_FILENAME = sys.argv[1] - - -def load_report(): - with open(REPORT_FILENAME, 'r') as file_in: - return json.load(file_in) - - -def compute_duplicates(report): - table = {} - for e in report: - bug_hash = e['hash'] - if bug_hash in table: - table[bug_hash].append(e) - else: - table[bug_hash] = [e] - duplicates = {} - for key, value in table.items(): - if len(value) >= 1: - duplicates[key] = value - return duplicates - - -def compute_max_hash(duplicates): - max_length = 0 - max_hash = 0 - for key, value in duplicates.items(): - length = len(value) - if length > max_length: - max_length = length - max_hash = key - return max_hash - - -def print_duplicates(duplicates): - with open('duplicates.txt', 'w') as file_out: - for key, value in duplicates.items(): - reports = set([(e['bug_type'], e['qualifier']) for e in value]) - messages = ['{} {}'.format(bug, msg) for (bug, msg) in reports] - if len(messages) > 1: - file_out.write('\nWith bug hash {}:\n\t{}\n'.format( - key, - '\n\t'.join(messages))) - - -report = load_report() -duplicates = compute_duplicates(report) -print_duplicates(duplicates) -max_hash = compute_max_hash(duplicates) -print('max hash: {}'.format(max_hash)) -duplicates = [e for e in report if e['hash'] == max_hash] -with open('duplicates.json', 'w') as file_out: - json.dump(duplicates, file_out, indent=2, separators=(',', ': '))