Skip to content

Commit

Permalink
labhub/assign: Support super-short issue ref
Browse files Browse the repository at this point in the history
... of the form `#1234`.

Closes #167
  • Loading branch information
Makman2 committed Oct 2, 2017
1 parent 4210e15 commit 33e5f50
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion plugins/labhub.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,27 @@ def process_short_ref(issue_reference):

return m.group(1), m.group(2), m.group(3)

# Extreme short issue reference (e.g. `#1234`)
def process_extreme_short_ref(issue_reference):
issue_rgx = r'#(\d+)'
issue_reference_match = re.fullmatch(rgx, issue_reference)

if issue_reference_match is None:
return None

roomname_rgx = r'(.+?)/(.+)'
roomname_match = re.fullmatch(
roomname_rgx, self.room.name, re.IGNORECASE)

if roommatch is None:
return None

return roommatch.group(1), roommatch.group(2), m.group(1)

issue_processors = [
process_full_url,
process_short_ref
process_short_ref,
process_extreme_short_ref
]

for issue_processor in issue_processor:
Expand Down

0 comments on commit 33e5f50

Please sign in to comment.