#!/usr/bin/env python3 import fnmatch import os import re import ntpath import sys import argparse def get_private_declare(content): priv_declared = [] srch = re.compile('private.*') priv_srch_declared = srch.findall(content) priv_srch_declared = sorted(set(priv_srch_declared)) priv_dec_str = ''.join(priv_srch_declared) srch = re.compile('(? 0: print (filepath) private_output = 'private['; first = True for bad_priv in missing: if first: first = False private_output = private_output + '"' + bad_priv else: private_output = private_output + '", "' + bad_priv private_output = private_output + '"];'; print (private_output) for bad_priv in missing: print ('\t' + bad_priv) bad_count_file = bad_count_file + 1 return bad_count_file def main(): print("#########################") print("# Search your Privates #") print("#########################") sqf_list = [] bad_count = 0 parser = argparse.ArgumentParser() parser.add_argument('-m','--module', help='only search specified module addon folder', required=False, default=".") args = parser.parse_args() for root, dirnames, filenames in os.walk('../addons' + '/' + args.module): for filename in fnmatch.filter(filenames, '*.sqf'): sqf_list.append(os.path.join(root, filename)) for filename in sqf_list: bad_count = bad_count + check_privates(filename) print ("Bad Count {0}".format(bad_count)) if __name__ == "__main__": main()