Skip to content

Commit 8333d78

Browse files
Fix #569: documentation whiteboard tags matching (#579)
* Fix #569: documentation whiteboard tags matching * Update jbi/models.py Co-authored-by: grahamalama <[email protected]> --------- Co-authored-by: grahamalama <[email protected]>
1 parent 6218585 commit 8333d78

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ System to sync Bugzilla bugs to Jira issues.
1212
- The events are transformed into Jira issues
1313
- The system sets the `see_also` field of the Bugzilla bug with the URL to the Jira issue
1414

15+
> **Note:** whiteboard tags are string between brackets, and can have prefixes/suffixes using
16+
> dashes (eg. ``[project]``, ``[project-fx-h2]``, ``[backlog-project]``).
17+
1518
## Diagram Overview
1619

1720
``` mermaid

jbi/actions/steps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ def _build_labels_update(labels_brackets, added, removed=None):
291291

292292
def sync_whiteboard_labels(context: ActionContext, **parameters):
293293
"""
294-
Set whiteboard tags as labels on the Jira issue
294+
Set whiteboard tags as labels on the Jira issue.
295295
"""
296296
labels_brackets = parameters.get("labels_brackets", "no")
297297
if labels_brackets not in ("yes", "no", "both"):

jbi/models.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,12 @@ def extract_from_see_also(self):
264264
return None
265265

266266
def lookup_action(self, actions: Actions) -> Action:
267-
"""Find first matching action from bug's whiteboard list"""
267+
"""
268+
Find first matching action from bug's whiteboard field.
269+
270+
Tags are strings between brackets and can have prefixes/suffixes
271+
using dashes (eg. ``[project]``, ``[project-moco]``, ``[backlog-project]``).
272+
"""
268273
if self.whiteboard:
269274
for tag, action in actions.by_tag.items():
270275
# [tag-word], [word-tag], [tag-], [tag], but not [wordtag]

tests/unit/test_bugzilla.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,14 @@ def test_lookup_action_found(whiteboard, actions_example):
5353
@pytest.mark.parametrize(
5454
"whiteboard",
5555
[
56-
"example DevTest",
56+
"DevTest",
57+
"foo DevTest",
58+
"DevTest bar",
59+
"foo DevTest bar",
5760
"[fooDevTest]",
61+
"[foo DevTest]",
5862
"[DevTestbar]",
63+
"[DevTest bar]",
5964
"[fooDevTestbar]",
6065
"[fooDevTest-bar]",
6166
"[foo-DevTestbar]",

0 commit comments

Comments
 (0)