def main(): args = parse_args() start = datetime.now() miner = MineManager(config_path=args.config) # get all nodes and relationships from the manager nodes, rels = miner.get_all_data(map=False, merge=False) print("The DB has a total of {} nodes and {} relationships".format( len(nodes), len(rels))) print("All data took: {}".format(datetime.now() - start))
def main(): args = parse_args() if 'jax' in args.config: file_query = { 'hash': '84a34a3b24d33ba7736a19f7009591d6d4af6aa4368680664fd3a5ae' } if 'hadoop' in args.config: file_query = { 'hash': '0f3a2c18d68cf908803c5493a39f5039b7effa929ada77b43325e806' } if 'kibana' in args.config: file_query = { 'hash': 'bafb026d5ad56f9975c0feb6ea387126b8d953e5061c26ed11737b48' } if 'tensorflow' in args.config: file_query = { 'hash': 'd5204d385a92141e49aa8ce8b6330fafd825c02e4ee5ed86747c8e73' } start = datetime.now() mine_manager = MineManager(config_path=args.config) updated_file_rels = mine_manager.file_miner.get_change_history( file_hash=file_query['hash']) nloc = [x['nloc'] for x in updated_file_rels] print('File nloc took {}'.format(datetime.now() - start)) print('File changes', len(updated_file_rels))
def main(): args = parse_args() if 'jax' in args.config: dev_query = { 'hash': '93476add93abfb4fcfdd5c61ed811099bbb2aab70874f554d38bf381'} if 'hadoop' in args.config: dev_query = { 'hash': 'c92a1ec4e3eec053698d080439dc284a824b4de6fd5a4c8351631685'} if 'kibana' in args.config: dev_query = { 'hash': 'bc95ed12093e3ca5ce0b30f4edda5b3692510d87b0b0bd08d2999750'} if 'tensorflow' in args.config: dev_query = { 'hash': '1dfed5c1dfcb5c5eaf63522b7d993b721774bb153ef4be087384e72e'} start = datetime.now() mine_manager = MineManager(config_path=args.config) files = mine_manager.dev_miner.get_files( dev_query['hash'], mine_manager.config.ct.project_id ) ft = [f['type'] for f in files] grouped = [{'file': x, 'count': len( [y for y in ft if x == y])} for x in set(ft)] print('Dev file types took {}'.format(datetime.now() - start)) print('Nr files', len(ft))
def main(): args = parse_args() if 'jax' in args.config: dev_query = { 'hash': '93476add93abfb4fcfdd5c61ed811099bbb2aab70874f554d38bf381'} if 'hadoop' in args.config: dev_query = { 'hash': 'c92a1ec4e3eec053698d080439dc284a824b4de6fd5a4c8351631685'} if 'kibana' in args.config: dev_query = { 'hash': 'bc95ed12093e3ca5ce0b30f4edda5b3692510d87b0b0bd08d2999750'} if 'tensorflow' in args.config: dev_query = { 'hash': '1dfed5c1dfcb5c5eaf63522b7d993b721774bb153ef4be087384e72e'} start = datetime.now() mine_manager = MineManager(config_path=args.config) method_updates = mine_manager.dev_miner.get_method_updates( dev_query['hash'], mine_manager.config.ct.project_id ) complexity = [c['complexity'] for c in method_updates if c['complexity'] != -1] _ = sum(complexity) / len(complexity) print('Dev file types took {}'.format(datetime.now() - start)) print('Nr method updates', len(method_updates))
def main(): args = parse_args() mine_manager = MineManager(config_path=args.config) file_miner = mine_manager.file_miner file_ = file_miner.query(pproject_id=mine_manager.config.ct.project_id, name="commit.py") updated_file_rels = file_miner.get_change_history(file_['hash']) # sort update relationships and transform data for plotting updated_file_rels.sort(key=lambda x: x['timestamp']) complexity = [x['complexity'] for x in updated_file_rels] nloc = [x['nloc'] for x in updated_file_rels] dts = [datetime.fromtimestamp(x['timestamp']) for x in updated_file_rels] fig = px.line(pd.DataFrame({ 'date': dts, 'complexity': complexity }), x='date', y='complexity', title='Complexity over time for the commit.py file') fig.show() fig_2 = px.line(pd.DataFrame({ 'date': dts, 'nloc': nloc }), x='date', y='nloc', title="NLOC over time for the commit.py file") fig_2.show()
def main(): args = parse_args() mine_manager = MineManager(config_path=args.config) files = mine_manager.dev_miner.get_files( "6cf1f138e29c1bf82810ad0b73012302e0d20c2f76a24e3b225017b0", mine_manager.config.ct.project_id ) print(len(files), ' files') file_updates = mine_manager.dev_miner.get_files_updates( "6cf1f138e29c1bf82810ad0b73012302e0d20c2f76a24e3b225017b0", mine_manager.config.ct.project_id ) print(len(file_updates), ' file updates') methods = mine_manager.dev_miner.get_methods( "6cf1f138e29c1bf82810ad0b73012302e0d20c2f76a24e3b225017b0", mine_manager.config.ct.project_id ) print(len(methods), ' methods') method_updates = mine_manager.dev_miner.get_method_updates( "6cf1f138e29c1bf82810ad0b73012302e0d20c2f76a24e3b225017b0", mine_manager.config.ct.project_id ) print(len(method_updates), ' method updates')
def main(): args = parse_args() start = datetime.now() miner = MineManager(config_path=args.config) # get all nodes and relationships from the manager nodes, rels = miner.get_all_data() print("The DB has a total of {} nodes and {} relationships".format( len(nodes), len(rels))) print("All data took: {}".format(datetime.now() - start)) # get all commits commits = miner.commit_miner.get_all() print("The DB has a total of {} commits".format(len(commits))) # get all developers devs = miner.dev_miner.get_all() print("The DB has a total of {} developers".format(len(devs))) # get all files files = miner.file_miner.get_all() print("The DB has a total of {} files".format(len(files)))
def main(): args = parse_args() if 'jax' in args.config: file_query = { 'hash': '84a34a3b24d33ba7736a19f7009591d6d4af6aa4368680664fd3a5ae' } if 'hadoop' in args.config: file_query = { 'hash': '0f3a2c18d68cf908803c5493a39f5039b7effa929ada77b43325e806' } if 'kibana' in args.config: file_query = { 'hash': 'bafb026d5ad56f9975c0feb6ea387126b8d953e5061c26ed11737b48' } if 'tensorflow' in args.config: file_query = { 'hash': 'd5204d385a92141e49aa8ce8b6330fafd825c02e4ee5ed86747c8e73' } start = datetime.now() mine_manager = MineManager(config_path=args.config) methods = mine_manager.file_miner.get_current_methods(file_query['hash']) m_changes = [] for m in methods: changes = mine_manager.method_miner.get_change_history(m['hash']) mc = [{ 'complexity': x['complexity'], 'date': datetime.fromtimestamp(x['timestamp']), 'name': m['name'] } for x in changes] m_changes = m_changes + mc print('All methods complexity took: {}'.format(datetime.now() - start)) print('Total methods: ', len(methods))
def main(): """Main""" args = parse_args() file_query = { 'hash': 'e2eb7bf414cebe68f46fa88e4abe9ae5813e91c4e1e97570f8e41cf4' } start = datetime.now() mine_manager = MineManager(config_path=args.config) methods = mine_manager.file_miner.get_current_methods(file_query['hash']) m_changes = [] for m in methods: changes = mine_manager.method_miner.get_change_history(m) mc = [{ 'complexity': x['complexity'], 'date': datetime.fromtimestamp(x['timestamp']), 'name': m['name'] } for x in changes] m_changes = m_changes + mc print('All methods complexity took: {}'.format(datetime.now() - start)) print('Total methods: ', len(methods)) if args.plot: df = pd.DataFrame(m_changes) df['date'] = pd.to_datetime(df.date) df = df.sort_values(by='date') fig = px.line(df, x="date", y="complexity", color="name", line_group="name", hover_name="name") fig.show()