Commit 0fb33b26 authored by Debrian Figueroa's avatar Debrian Figueroa Committed by Commit Bot

Updated presubmit error message format.

Changed all headers in message to be the size of header 4 tags.

Made sure there is always a new line after code tag(```).

Change-Id: I772941a8bbf0634c9496ec648533110997e23cde
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1702293
Commit-Queue: Debrian Figueroa <debrian@google.com>
Reviewed-by: 's avatarRobbie Iannucci <iannucci@chromium.org>
parent 65c2b1e1
......@@ -175,9 +175,10 @@ def _limitSize(message_list, char_limit=450):
# If code is being cropped, the closing code tag will
# get removed, so add it back before the hint.
code_tag = '```'
oversized_msg = ('%s\n**Error size > %d chars, '
message_list[index - 1] = '\n'.join((message_list[index - 1], code_tag))
oversized_msg = ('\n**Error size > %d chars, '
'there are %d more error(s) (%d total)**') % (
code_tag, char_limit, total_errors - index, total_errors
char_limit, total_errors - index, total_errors
)
return message_list[:index] + [oversized_msg, hint]
return message_list
......@@ -223,7 +224,7 @@ def _createSummaryMarkdown(step_json):
warning_count = len(step_json['warnings'])
notif_count = len(step_json['notifications'])
description = (
'### There are %d error(s), %d warning(s),'
'#### There are %d error(s), %d warning(s),'
' and %d notifications(s). Here are the errors:') % (
len(errors), warning_count, notif_count
)
......@@ -241,7 +242,7 @@ def _createSummaryMarkdown(step_json):
error_messages.insert(0, description)
if warning_count or notif_count:
error_messages.append(
('##### To see notifications and warnings,'
('#### To see notifications and warnings,'
' look at the stdout of the presubmit step.')
)
return '\n\n'.join(error_messages)
......
......@@ -78,7 +78,7 @@ def GenTests(api):
api.post_process(post_process.StatusFailure) +
api.post_process(
post_process.ResultReason,
(u'### There are 0 error(s), 0 warning(s), and 0 notifications(s).'
(u'#### There are 0 error(s), 0 warning(s), and 0 notifications(s).'
' Here are the errors:'
'\n\nTimeout occurred during presubmit step.')) +
api.post_process(post_process.DropExpectation)
......@@ -124,7 +124,7 @@ def GenTests(api):
) +
api.post_process(post_process.StatusFailure) +
api.post_process(post_process.ResultReason, textwrap.dedent(u'''
### There are 2 error(s), 1 warning(s), and 1 notifications(s). Here are the errors:
#### There are 2 error(s), 1 warning(s), and 1 notifications(s). Here are the errors:
**ERROR**
```
......@@ -138,7 +138,7 @@ def GenTests(api):
Expected "," after item in list
```
##### To see notifications and warnings, look at the stdout of the presubmit step.
#### To see notifications and warnings, look at the stdout of the presubmit step.
''').strip()
) +
api.post_process(post_process.DropExpectation)
......@@ -166,7 +166,7 @@ def GenTests(api):
) +
api.post_process(post_process.StatusFailure) +
api.post_process(post_process.ResultReason, textwrap.dedent('''
### There are 1 error(s), 0 warning(s), and 0 notifications(s). Here are the errors:
#### There are 1 error(s), 0 warning(s), and 0 notifications(s). Here are the errors:
**ERROR**
```
......@@ -182,6 +182,7 @@ def GenTests(api):
reallyLongFakeAccountNameEmail@chromium.org
reallyLongFakeAccountNameEmail@chromium.org
```
**Error size > 450 chars, there are 2 more error(s) (15 total)**
**The complete output can be found at the bottom of the presubmit stdout.**
''').strip()
......@@ -209,7 +210,7 @@ def GenTests(api):
) +
api.post_process(post_process.StatusException) +
api.post_process(post_process.ResultReason, textwrap.dedent(u'''
### There are 1 error(s), 0 warning(s), and 0 notifications(s). Here are the errors:
#### There are 1 error(s), 0 warning(s), and 0 notifications(s). Here are the errors:
**ERROR**
```
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment