mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-06 22:00:40 +08:00
s
This commit is contained in:
@ -269,7 +269,7 @@ class PRDescription:
|
|||||||
for idx, (key, value) in enumerate(self.data.items()):
|
for idx, (key, value) in enumerate(self.data.items()):
|
||||||
if key == 'pr_files':
|
if key == 'pr_files':
|
||||||
value = self.file_label_dict
|
value = self.file_label_dict
|
||||||
key_publish = "PR changes summary"
|
key_publish = "PR changes walkthrough"
|
||||||
else:
|
else:
|
||||||
key_publish = key.rstrip(':').replace("_", " ").capitalize()
|
key_publish = key.rstrip(':').replace("_", " ").capitalize()
|
||||||
pr_body += f"## {key_publish}\n"
|
pr_body += f"## {key_publish}\n"
|
||||||
@ -318,9 +318,9 @@ class PRDescription:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
pr_body += "<table>"
|
pr_body += "<table>"
|
||||||
header = f"Relevant Files"
|
header = f"Relevant files"
|
||||||
delta = 65
|
delta = 65
|
||||||
header +=" " * delta
|
header += " " * delta
|
||||||
pr_body += f"""<thead><tr><th></th><th>{header}</th></tr></thead>"""
|
pr_body += f"""<thead><tr><th></th><th>{header}</th></tr></thead>"""
|
||||||
pr_body += """<tbody>"""
|
pr_body += """<tbody>"""
|
||||||
for semantic_label in value.keys():
|
for semantic_label in value.keys():
|
||||||
@ -332,15 +332,15 @@ class PRDescription:
|
|||||||
filename = filename.replace("'", "`")
|
filename = filename.replace("'", "`")
|
||||||
filename_publish = filename.split("/")[-1]
|
filename_publish = filename.split("/")[-1]
|
||||||
filename_publish = f"{filename_publish}"
|
filename_publish = f"{filename_publish}"
|
||||||
if len(filename_publish)< (delta-5):
|
if len(filename_publish) < (delta - 5):
|
||||||
filename_publish += " " * ((delta-5) - len(filename_publish))
|
filename_publish += " " * ((delta - 5) - len(filename_publish))
|
||||||
diff_plus_minus = ""
|
diff_plus_minus = ""
|
||||||
diff_files = self.git_provider.diff_files
|
diff_files = self.git_provider.diff_files
|
||||||
for f in diff_files:
|
for f in diff_files:
|
||||||
if f.filename.lower() == filename.lower():
|
if f.filename.lower() == filename.lower():
|
||||||
num_plus_lines = f.num_plus_lines
|
num_plus_lines = f.num_plus_lines
|
||||||
num_minus_lines = f.num_minus_lines
|
num_minus_lines = f.num_minus_lines
|
||||||
diff_plus_minus += f" (+{num_plus_lines}/-{num_minus_lines})"
|
diff_plus_minus += f"+{num_plus_lines}/-{num_minus_lines}"
|
||||||
break
|
break
|
||||||
|
|
||||||
# try to add line numbers link to code suggestions
|
# try to add line numbers link to code suggestions
|
||||||
@ -349,7 +349,7 @@ class PRDescription:
|
|||||||
filename = filename.strip()
|
filename = filename.strip()
|
||||||
link = self.git_provider.get_line_link(filename, relevant_line_start=-1)
|
link = self.git_provider.get_line_link(filename, relevant_line_start=-1)
|
||||||
|
|
||||||
file_change_description = self._insert_br_after_x_chars(file_change_description, x=(delta-5))
|
file_change_description = self._insert_br_after_x_chars(file_change_description, x=(delta - 5))
|
||||||
pr_body += f"""
|
pr_body += f"""
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
@ -368,48 +368,6 @@ class PRDescription:
|
|||||||
pr_body += """</table></details></td></tr>"""
|
pr_body += """</table></details></td></tr>"""
|
||||||
pr_body += """</tr></tbody></table>"""
|
pr_body += """</tr></tbody></table>"""
|
||||||
|
|
||||||
# pr_body += """\n| | Relevant Files """
|
|
||||||
# pr_body += " " * 70
|
|
||||||
# pr_body += """|\n|-----------|-------------|\n"""
|
|
||||||
# for semantic_label in value.keys():
|
|
||||||
# s_label = semantic_label.strip("'").strip('"')
|
|
||||||
# if self.git_provider.is_supported("gfm_markdown"):
|
|
||||||
# # pr_body += f"<details> <summary>{semantic_label['label']}</summary>\n\n"
|
|
||||||
# pr_body += f"| **{s_label}** | <details><summary>files:</summary><ul>"
|
|
||||||
#
|
|
||||||
# list_tuples = value[semantic_label]
|
|
||||||
# for filename, file_change_description in list_tuples:
|
|
||||||
# filename = filename.replace("'", "`")
|
|
||||||
# filename_publish = filename.split("/")[-1]
|
|
||||||
# filename_publish = f"**{filename_publish}**"
|
|
||||||
# diff_plus_minus = ""
|
|
||||||
# diff_files = self.git_provider.diff_files
|
|
||||||
# for f in diff_files:
|
|
||||||
# if f.filename.lower() == filename.lower():
|
|
||||||
# num_plus_lines = f.num_plus_lines
|
|
||||||
# num_minus_lines = f.num_minus_lines
|
|
||||||
# diff_plus_minus += f" ( +{num_plus_lines}/-{num_minus_lines} )"
|
|
||||||
# break
|
|
||||||
#
|
|
||||||
# # try to add line numbers link to code suggestions
|
|
||||||
# if hasattr(self.git_provider, 'get_line_link'):
|
|
||||||
# filename = filename.strip()
|
|
||||||
# link = self.git_provider.get_line_link(filename, relevant_line_start=-1)
|
|
||||||
# if link:
|
|
||||||
# diff_plus_minus = f"[{diff_plus_minus}]({link})"
|
|
||||||
# diff_plus_minus = f" <sup>{diff_plus_minus}</sup>"
|
|
||||||
#
|
|
||||||
# if diff_plus_minus:
|
|
||||||
# filename_publish += diff_plus_minus
|
|
||||||
# if self.git_provider.is_supported("gfm_markdown"):
|
|
||||||
# pr_body += f"<details><summary>{filename_publish}</summary>"
|
|
||||||
# file_change_description = self._insert_br_after_x_chars(file_change_description)
|
|
||||||
# if diff_plus_minus:
|
|
||||||
# pr_body += f"<ul>Changes summary:<br>**{file_change_description}**</ul></details>"
|
|
||||||
# else:
|
|
||||||
# pr_body += f"<ul>Changes summary:<br>**{file_change_description}**</ul></details>"
|
|
||||||
# if self.git_provider.is_supported("gfm_markdown"):
|
|
||||||
# pr_body += "</ul></details>|\n"
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
get_logger().error(f"Error processing pr files to markdown {self.pr_id}: {e}")
|
get_logger().error(f"Error processing pr files to markdown {self.pr_id}: {e}")
|
||||||
pass
|
pass
|
||||||
|
Reference in New Issue
Block a user