diff --git a/pr_agent/algo/utils.py b/pr_agent/algo/utils.py
index 36ca8a15..ef2e5712 100644
--- a/pr_agent/algo/utils.py
+++ b/pr_agent/algo/utils.py
@@ -51,7 +51,7 @@ def convert_to_markdown(output_data: dict, gfm_supported: bool=True) -> str:
markdown_text += f"## PR Review\n\n"
if gfm_supported:
markdown_text += "
\n\n"
- markdown_text += """ PR feedback | |
"""
+ # markdown_text += """ Feedback | | """
if not output_data or not output_data.get('review', {}):
return ""
@@ -62,7 +62,25 @@ def convert_to_markdown(output_data: dict, gfm_supported: bool=True) -> str:
key_nice = key.replace('_', ' ').capitalize()
emoji = emojis.get(key_nice, "")
if gfm_supported:
- markdown_text += f" {emoji} {key_nice} | \n\n{value}\n\n |
\n"
+ if 'Estimated effort to review' in key_nice:
+ key_nice = 'Estimated effort to review [1-5]'
+ if 'possible issues' in key_nice.lower():
+ value = value.strip()
+ issues = value.split('\n- ')
+ number_of_issues = len(issues)
+ if number_of_issues > 1:
+ markdown_text += f" {emoji} {key_nice} | \n"
+ for i, issue in enumerate(issues):
+ issue = issue.strip('-').strip()
+ if i == 0:
+ markdown_text += f"\n\n{issue} |
\n"
+ else:
+ markdown_text += f"\n\n\n{issue} |
\n"
+ else:
+ value = value.strip('-').strip()
+ markdown_text += f" {emoji} {key_nice} | \n\n{value}\n\n |
\n"
+ else:
+ markdown_text += f" {emoji} {key_nice} | \n\n{value}\n\n |
\n"
else:
if len(value.split()) > 1:
markdown_text += f"{emoji} **{key_nice}:**\n\n {value}\n\n"
diff --git a/tests/unittest/test_convert_to_markdown.py b/tests/unittest/test_convert_to_markdown.py
index 0b0af128..5337ac6b 100644
--- a/tests/unittest/test_convert_to_markdown.py
+++ b/tests/unittest/test_convert_to_markdown.py
@@ -52,7 +52,7 @@ class TestConvertToMarkdown:
'suggestion': "Consider raising an exception or logging a warning when 'pr_url' attribute is not found. This can help in debugging issues related to the absence of 'pr_url' in instances where it's expected. [important]\n",
'relevant_line': '[return ""](https://github.com/Codium-ai/pr-agent-pro/pull/102/files#diff-52d45f12b836f77ed1aef86e972e65404634ea4e2a6083fb71a9b0f9bb9e062fR199)'}]}
- expected_output = '## PR Review\n\n\n\n PR feedback | |
โฑ๏ธ Estimated effort to review [1-5] | \n\n1, because the changes are minimal and straightforward, focusing on a single functionality addition.\n\n\n |
\n ๐งช Relevant tests | \n\nNo\n\n\n |
\n ๐ Possible issues | \n\nNo\n\n\n |
\n ๐ Security concerns | \n\nNo\n\n\n |
\n
\n\n\n Code feedback:
\n\n
relevant file | pr_agent/git_providers/git_provider.py\n |
suggestion | \n\n\n\nConsider raising an exception or logging a warning when \'pr_url\' attribute is not found. This can help in debugging issues related to the absence of \'pr_url\' in instances where it\'s expected. [important]\n\n\n |
relevant line | return "" |
\n\n '
+ expected_output = '## PR Review\n\n\n\n
โฑ๏ธ Estimated effort to review [1-5] | \n\n1, because the changes are minimal and straightforward, focusing on a single functionality addition.\n\n\n |
\n ๐งช Relevant tests | \n\nNo\n\n\n |
\n ๐ Possible issues | \n\nNo\n\n |
\n ๐ Security concerns | \n\nNo\n\n\n |
\n
\n\n\n Code feedback:
\n\n
relevant file | pr_agent/git_providers/git_provider.py\n |
suggestion | \n\n\n\nConsider raising an exception or logging a warning when \'pr_url\' attribute is not found. This can help in debugging issues related to the absence of \'pr_url\' in instances where it\'s expected. [important]\n\n\n |
relevant line | return "" |
\n\n '
assert convert_to_markdown(input_data).strip() == expected_output.strip()