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,28 +121,33 @@ class Review:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def reviewers(self):
|
def reviewers(self):
|
||||||
for label in self._data['labels']['Code-Review']['all']:
|
labels = self._data['labels']
|
||||||
if label['value'] not in (2, -1):
|
|
||||||
# Only report reviewers with negative reviews or
|
if 'Code-Review' in labels:
|
||||||
# approvals to avoid counting anyone who is just
|
for label in labels['Code-Review']['all']:
|
||||||
# leaving lots of +1 votes without actually providing
|
if label['value'] not in (2, -1):
|
||||||
# feedback.
|
# Only report reviewers with negative reviews or
|
||||||
continue
|
# approvals to avoid counting anyone who is just
|
||||||
yield Participant(
|
# leaving lots of +1 votes without actually providing
|
||||||
'reviewer',
|
# feedback.
|
||||||
label['name'],
|
continue
|
||||||
label['email'],
|
yield Participant(
|
||||||
_to_datetime(label['date']),
|
'reviewer',
|
||||||
)
|
label['name'],
|
||||||
for label in self._data['labels']['Workflow']['all']:
|
label['email'],
|
||||||
if label.get('value', 0) != 1:
|
_to_datetime(label['date']),
|
||||||
continue
|
)
|
||||||
yield Participant(
|
|
||||||
'approver',
|
if 'Workflow' in labels:
|
||||||
label['name'],
|
for label in labels['Workflow']['all']:
|
||||||
label['email'],
|
if label.get('value', 0) != 1:
|
||||||
_to_datetime(label['date']),
|
continue
|
||||||
)
|
yield Participant(
|
||||||
|
'approver',
|
||||||
|
label['name'],
|
||||||
|
label['email'],
|
||||||
|
_to_datetime(label['date']),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def cache_review(review_id, data, cache):
|
def cache_review(review_id, data, cache):
|
||||||
|
Loading…
Reference in New Issue
Block a user