Skip to content

Commit

Permalink
labhub/assign: Support short issue references
Browse files Browse the repository at this point in the history
... of the form `#12`.
  • Loading branch information
Makman2 committed Oct 2, 2017
1 parent ae2a2b1 commit 4210e15
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion plugins/labhub.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,19 @@ def process_full_url(issue_reference):

return m.group(2), m.group(3)[:-1], m.group(4)

# Short issue reference (e.g. `coala/corobo#12`)
def process_short_ref(issue_reference):
rgx = r'(.+?)/(.+?)#(\d+)'
m = re.fullmatch(rgx, issue_reference, re.IGNORECASE)

if m is None:
return None

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

issue_processors = [
process_full_url
process_full_url,
process_short_ref
]

for issue_processor in issue_processor:
Expand Down

0 comments on commit 4210e15

Please sign in to comment.