Show More
@@ -1316,16 +1316,26 b' class MergeCheck(object):' | |||
|
1316 | 1316 | Perform Merge Checks and returns a check object which stores information |
|
1317 | 1317 | about merge errors, and merge conditions |
|
1318 | 1318 | """ |
|
1319 | TODO_CHECK = 'todo' | |
|
1320 | PERM_CHECK = 'perm' | |
|
1321 | REVIEW_CHECK = 'review' | |
|
1322 | MERGE_CHECK = 'merge' | |
|
1319 | 1323 | |
|
1320 | 1324 | def __init__(self): |
|
1321 | 1325 | self.merge_possible = None |
|
1322 | 1326 | self.merge_msg = '' |
|
1323 | 1327 | self.failed = None |
|
1324 | 1328 | self.errors = [] |
|
1329 | self.error_details = OrderedDict() | |
|
1325 | 1330 | |
|
1326 | def push_error(self, error_type, message): | |
|
1331 | def push_error(self, error_type, message, error_key, details): | |
|
1327 | 1332 | self.failed = True |
|
1328 | 1333 | self.errors.append([error_type, message]) |
|
1334 | self.error_details[error_key] = dict( | |
|
1335 | details=details, | |
|
1336 | error_type=error_type, | |
|
1337 | message=message | |
|
1338 | ) | |
|
1329 | 1339 | |
|
1330 | 1340 | @classmethod |
|
1331 | 1341 | def validate(cls, pull_request, user, fail_early=False, translator=None): |
@@ -1341,7 +1351,7 b' class MergeCheck(object):' | |||
|
1341 | 1351 | log.debug("MergeCheck: cannot merge, approval is pending.") |
|
1342 | 1352 | |
|
1343 | 1353 | msg = _('User `{}` not allowed to perform merge').format(user) |
|
1344 | merge_check.push_error('error', msg) | |
|
1354 | merge_check.push_error('error', msg, cls.PERM_CHECK, user.username) | |
|
1345 | 1355 | if fail_early: |
|
1346 | 1356 | return merge_check |
|
1347 | 1357 | |
@@ -1353,7 +1363,8 b' class MergeCheck(object):' | |||
|
1353 | 1363 | |
|
1354 | 1364 | msg = _('Pull request reviewer approval is pending.') |
|
1355 | 1365 | |
|
1356 |
merge_check.push_error( |
|
|
1366 | merge_check.push_error( | |
|
1367 | 'warning', msg, cls.REVIEW_CHECK, review_status) | |
|
1357 | 1368 | |
|
1358 | 1369 | if fail_early: |
|
1359 | 1370 | return merge_check |
@@ -1371,7 +1382,7 b' class MergeCheck(object):' | |||
|
1371 | 1382 | msg = _('Cannot merge, {} TODOs still not resolved.').format( |
|
1372 | 1383 | len(todos)) |
|
1373 | 1384 | |
|
1374 | merge_check.push_error('warning', msg) | |
|
1385 | merge_check.push_error('warning', msg, cls.TODO_CHECK, todos) | |
|
1375 | 1386 | |
|
1376 | 1387 | if fail_early: |
|
1377 | 1388 | return merge_check |
@@ -1383,7 +1394,7 b' class MergeCheck(object):' | |||
|
1383 | 1394 | if not merge_status: |
|
1384 | 1395 | log.debug( |
|
1385 | 1396 | "MergeCheck: cannot merge, pull request merge not possible.") |
|
1386 | merge_check.push_error('warning', msg) | |
|
1397 | merge_check.push_error('warning', msg, cls.MERGE_CHECK, None) | |
|
1387 | 1398 | |
|
1388 | 1399 | if fail_early: |
|
1389 | 1400 | return merge_check |
General Comments 0
You need to be logged in to leave comments.
Login now