Skip to content

Commit b1872ee

Browse files
committed
Enhance label description checks in ChangeClass and Change classes
Updated the label description checks to ensure they are not None before performing regex matching. This improves robustness in handling labels in the changelog processing.
1 parent 11097ff commit b1872ee

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

dev/_changelog.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def __init__(self, label: github.LabelInfo) -> None:
2626
self._label = label
2727
self._aspect_type = None
2828
self._aspect_pattern = ChangeClass.DefaultPattern
29-
if m := re.match(r".*\[(.+?)(->(.+?))?\].*", label.description):
29+
if label.description and (m := re.match(r".*\[(.+?)(->(.+?))?\].*", label.description)):
3030
self._aspect_type = m.groups()[0]
3131
if pattern := m.groups()[2]:
3232
self._aspect_pattern = f"- {pattern}"
@@ -125,7 +125,7 @@ def subsystems(self):
125125
return [
126126
ChangeClass(x)
127127
for x in self._ticketdata.labels
128-
if "[subsystem" in x.description
128+
if x.description and "[subsystem" in x.description
129129
]
130130
return []
131131

@@ -136,7 +136,7 @@ def classes(self):
136136
return [
137137
ChangeClass(x)
138138
for x in self._ticketdata.labels
139-
if "[class" in x.description
139+
if x.description and "[class" in x.description
140140
]
141141
return []
142142

dev/scripts/github.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def get_ticket(ticket: str):
4949
ticket_labels = []
5050
if labels := issue.get("labels", []):
5151
ticket_labels = [
52-
LabelInfo(name=x["name"], description=x["description"])
52+
LabelInfo(name=x["name"], description=x.get("description") or "")
5353
for x in labels
5454
]
5555
else:

0 commit comments

Comments
 (0)