Add help links to bot messages. (#28903)

This commit is contained in:
Matt Clay 2017-08-31 16:39:37 -07:00 committed by GitHub
parent e132918b92
commit 79dcb3a3fa

View file

@ -261,9 +261,9 @@ class TestFailure(TestResult):
"""
:type args: TestConfig
"""
message = self.format_title()
output = self.format_block()
docs = self.find_docs()
message = self.format_title(help_link=docs)
output = self.format_block()
if self.messages:
verified = all((m.confidence or 0) >= 50 for m in self.messages)
@ -331,8 +331,9 @@ class TestFailure(TestResult):
return None
def format_title(self):
def format_title(self, help_link=None):
"""
:type help_link: str | None
:rtype: str
"""
command = self.format_command()
@ -342,7 +343,12 @@ class TestFailure(TestResult):
else:
reason = 'error' if len(self.messages) == 1 else 'errors'
title = 'The test `%s` failed with the following %s:' % (command, reason)
if help_link:
help_link_markup = ' [[?](%s)]' % help_link
else:
help_link_markup = ''
title = 'The test `%s`%s failed with the following %s:' % (command, help_link_markup, reason)
return title