teamstats: Add stats related to team size.
Update the teamstats script to be able to determine the number of active committers and active reviewers. An active committer is defined as someone with 6 commits over the last 6 months. An active reviewer is defined as someone with 30 reviews over the last 6 months. These values are completely arbitrary. They don't matter yet since no tag is defined that depends on it. Change-Id: I80c1ae2fb5e5b3fed20475777cfbc0fa7f70b9b3 Signed-off-by: Russell Bryant <rbryant@redhat.com>
This commit is contained in:
parent
a470cf2b75
commit
48076c478d
@ -25,6 +25,33 @@ s = requests.session()
|
||||
|
||||
six_months = int(time.time() - 30*6*24*60*60) # 6 months ago
|
||||
|
||||
MIN_REVIEWS = 30
|
||||
MIN_COMMITS = 6
|
||||
|
||||
|
||||
def get_team_size_stats(team):
|
||||
team_stats = {}
|
||||
group = "%s-group" % team.lower()
|
||||
reviews = s.get('http://stackalytics.com/api/'
|
||||
'1.0/stats/engineers?metric=marks&release=all'
|
||||
'&start_date=%s&project_type=all'
|
||||
'&module=%s' % (six_months, group)).json()
|
||||
team_stats['active_reviewers'] = 0
|
||||
for eng in reviews['stats']:
|
||||
if eng['metric'] >= MIN_REVIEWS:
|
||||
team_stats['active_reviewers'] += 1
|
||||
|
||||
team_stats['active_committers'] = 0
|
||||
commits = s.get('http://stackalytics.com/api/'
|
||||
'1.0/stats/engineers?metric=commits&release=all'
|
||||
'&project_type=all&module=%s&start_date=%s'
|
||||
% (group, six_months)).json()
|
||||
for eng in commits['stats']:
|
||||
if eng['metric'] >= MIN_COMMITS:
|
||||
team_stats['active_committers'] += 1
|
||||
|
||||
return team_stats
|
||||
|
||||
|
||||
def get_core_reviews_by_company(group):
|
||||
# reviews by individual
|
||||
@ -134,6 +161,13 @@ def print_diversity(team):
|
||||
team_stats['core_reviews_top2'], team_stats['core_reviewers_top2'])
|
||||
|
||||
|
||||
def print_team_size(team):
|
||||
team_stats = get_team_size_stats(team)
|
||||
print '%-18s (%6s | %6s)' % (
|
||||
'', team_stats['active_committers'],
|
||||
team_stats['active_reviewers'])
|
||||
|
||||
|
||||
class ValidateDiversity(base.ValidatorBase):
|
||||
|
||||
@staticmethod
|
||||
@ -155,8 +189,10 @@ def main():
|
||||
'top core reviewer %)'
|
||||
print ' (top 2 commit % | top 2 review % | top 2 core review % | ' \
|
||||
'top 2 core reviewer %)'
|
||||
print ' (active committers | active reviewers)'
|
||||
for project in projects:
|
||||
print_diversity(project)
|
||||
print_team_size(project)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
Reference in New Issue
Block a user