Skip to content
This repository was archived by the owner on Mar 14, 2023. It is now read-only.

Commit baea70b

Browse files
authored
Fixes #326 with python string .lower() check (#358)
* use lower() to fix #326 * Fix nonetype doesn't have lower * Use elif
1 parent d19ce5c commit baea70b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

highfive/newpr.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -325,17 +325,22 @@ def pick_reviewer(self, groups, potential, exclude):
325325
p = potential.pop()
326326
if p.startswith('@'):
327327
# remove the '@' prefix from each username
328-
reviewers.append(p[1:])
328+
username = p[1:]
329+
330+
# If no one should be excluded add the reviewer
331+
if exclude == None:
332+
reviewers.append(username)
333+
334+
# ensure we don't assign someone to their own PR due with a case-insensitive test
335+
elif username.lower() != exclude.lower():
336+
reviewers.append(username)
329337
elif p in groups:
330338
# avoid infinite loops
331339
assert p not in seen, "group %s refers to itself" % p
332340
seen.add(p)
333341
# we allow groups in groups, so they need to be queued to be resolved
334342
potential.extend(groups[p])
335343

336-
if exclude in reviewers:
337-
reviewers.remove(exclude)
338-
339344
if reviewers:
340345
random.seed()
341346
return random.choice(reviewers)

0 commit comments

Comments
 (0)