protect against missing labels on reviews
Do not fail if gerrit does not report any Workflow or Code-Review data. Change-Id: I1e7fdc901db70766c3febb55263c1dac62c31676 Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
parent
e392142765
commit
161b6e9be6
@ -121,7 +121,10 @@ class Review:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def reviewers(self):
|
def reviewers(self):
|
||||||
for label in self._data['labels']['Code-Review']['all']:
|
labels = self._data['labels']
|
||||||
|
|
||||||
|
if 'Code-Review' in labels:
|
||||||
|
for label in labels['Code-Review']['all']:
|
||||||
if label['value'] not in (2, -1):
|
if label['value'] not in (2, -1):
|
||||||
# Only report reviewers with negative reviews or
|
# Only report reviewers with negative reviews or
|
||||||
# approvals to avoid counting anyone who is just
|
# approvals to avoid counting anyone who is just
|
||||||
@ -134,7 +137,9 @@ class Review:
|
|||||||
label['email'],
|
label['email'],
|
||||||
_to_datetime(label['date']),
|
_to_datetime(label['date']),
|
||||||
)
|
)
|
||||||
for label in self._data['labels']['Workflow']['all']:
|
|
||||||
|
if 'Workflow' in labels:
|
||||||
|
for label in labels['Workflow']['all']:
|
||||||
if label.get('value', 0) != 1:
|
if label.get('value', 0) != 1:
|
||||||
continue
|
continue
|
||||||
yield Participant(
|
yield Participant(
|
||||||
|
Loading…
Reference in New Issue
Block a user