2023-10-19 16:46:00 +00:00
|
|
|
import perceval
|
2023-10-23 20:40:24 +00:00
|
|
|
import os
|
|
|
|
import yaml
|
2023-10-26 15:57:56 +00:00
|
|
|
import datetime as dt
|
|
|
|
|
2023-10-23 20:40:24 +00:00
|
|
|
import perceval_tasks as pt
|
|
|
|
import github_api_req as gha
|
2023-10-26 15:57:56 +00:00
|
|
|
import gh_gsql_req as ghs
|
2023-10-23 20:40:24 +00:00
|
|
|
|
|
|
|
def main():
|
|
|
|
# we should discuss whether we're using the 93 day window that seems to be widely used or if we want a longer window
|
2023-10-27 17:25:33 +00:00
|
|
|
early_cutoff = dt.datetime(2023,10, 11)
|
2023-10-24 01:11:51 +00:00
|
|
|
print("Earliest date examined: " + str(early_cutoff))
|
2023-10-23 20:40:24 +00:00
|
|
|
#placeholder for now
|
|
|
|
manifest = '../kaylea_dissertation/lifecycle/package_metadata/jupyter-notebook_manifest.yaml'
|
|
|
|
with open(manifest, 'r') as stream:
|
|
|
|
try:
|
|
|
|
config = yaml.safe_load(stream)
|
|
|
|
#below lines will probably need to be refactored as tasks expand
|
|
|
|
vcs_path = config['Upstream_VCS']
|
2023-10-24 01:11:51 +00:00
|
|
|
print("------------------")
|
|
|
|
print(vcs_path)
|
2023-10-23 20:40:24 +00:00
|
|
|
perceval_obj = pt.main(vcs_path, early_cutoff)
|
|
|
|
gha_obj = gha.main(vcs_path, early_cutoff)
|
|
|
|
#these are the two variables in the denominator of the formality measure
|
2023-10-24 01:11:51 +00:00
|
|
|
print("Age of Project: " + str(perceval_obj['age_of_project']))
|
|
|
|
print('Contributor Count: ' + str(len(perceval_obj['contributors'])))
|
|
|
|
print('Collaborator Count: ' + str(len(perceval_obj['collaborators'])))
|
|
|
|
print('Number of Milestones: ' + str(gha_obj['milestone_count']))
|
|
|
|
new_mmt = compute_new_mmt(len(perceval_obj['contributors']), len(perceval_obj['collaborators']))
|
|
|
|
print('New MMT: ' + str(new_mmt))
|
|
|
|
old_mmt = compute_old_mmt(len(perceval_obj['contributors']), len(perceval_obj['collaborators']))
|
|
|
|
print('Old MMT: ' + str(old_mmt))
|
|
|
|
#new mmt formality score
|
|
|
|
new_formality = compute_formality_score(new_mmt, gha_obj['milestone_count'], perceval_obj['age_of_project'])
|
|
|
|
print(new_formality)
|
2023-10-26 15:57:56 +00:00
|
|
|
# testing out beneath:
|
2023-10-27 17:25:33 +00:00
|
|
|
ghs_obj = ghs.main(vcs_path, early_cutoff)
|
|
|
|
print(ghs_obj["time_cleaned_comm"])
|
2023-10-23 20:40:24 +00:00
|
|
|
except yaml.YAMLOError as err:
|
|
|
|
print(err)
|
|
|
|
|
2023-10-24 01:11:51 +00:00
|
|
|
#this is Yoshi 2 MMT per van Meijel
|
|
|
|
def compute_new_mmt(contrib_count, collab_count):
|
|
|
|
return (contrib_count + collab_count * 2) / (contrib_count + collab_count)
|
|
|
|
|
|
|
|
#this is Yoshi 1 mmt per Tamburri
|
|
|
|
def compute_old_mmt(contrib_count, collab_count):
|
|
|
|
return (contrib_count) / (contrib_count + collab_count)
|
|
|
|
|
|
|
|
#formality score
|
|
|
|
def compute_formality_score(mmt, milestones, lifetime):
|
|
|
|
return mmt / (milestones / lifetime)
|
2023-10-23 20:40:24 +00:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|