summaryrefslogtreecommitdiff
path: root/danger
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2019-04-05 11:20:44 +0100
committerSean McGivern <sean@gitlab.com>2019-04-05 11:20:44 +0100
commitdea11717249b98383e4c5435b885287230680616 (patch)
treeac55ec5627cfeb004d415a7dfa377b3debeef3e1 /danger
parent0b7f904635512d61149a502a2063cc1452514137 (diff)
downloadgitlab-ce-dea11717249b98383e4c5435b885287230680616.tar.gz
Make trainee maintainers three times as likely to be picked60035-weight-trainee-maintainers-higher-in-reviewer-roulette
Trainee maintainers count as reviewers, but should get more reviews than most reviewers, as they need practice to become a maintainer. This makes them three times as likely to be picked (compared to another reviewer; compared to before, it's roughly twice as likely at the current numbers for each). Also, switch to `Array#sample` because I think it looks nicer.
Diffstat (limited to 'danger')
-rw-r--r--danger/roulette/Dangerfile6
1 files changed, 4 insertions, 2 deletions
diff --git a/danger/roulette/Dangerfile b/danger/roulette/Dangerfile
index 3a4625c4eb6..81ee0397bdc 100644
--- a/danger/roulette/Dangerfile
+++ b/danger/roulette/Dangerfile
@@ -31,13 +31,15 @@ MARKDOWN
def spin(team, project, category)
reviewers = team.select { |member| member.reviewer?(project, category) }
+ traintainers = team.select { |member| member.traintainer?(project, category) }
maintainers = team.select { |member| member.maintainer?(project, category) }
# TODO: filter out people who are currently not in the office
# TODO: take CODEOWNERS into account?
- reviewer = reviewers[rand(reviewers.size)]
- maintainer = maintainers[rand(maintainers.size)]
+ # Make traintainers have triple the chance to be picked as a reviewer
+ reviewer = (reviewers + traintainers + traintainers).sample
+ maintainer = maintainers.sample
"| #{helper.label_for_category(category)} | #{reviewer&.markdown_name} | #{maintainer&.markdown_name} |"
end