improved review

This commit is contained in:
mrT23
2023-08-22 20:10:36 +03:00
parent 4184f81090
commit 04be1573d5
5 changed files with 67 additions and 31 deletions

View File

@ -32,33 +32,37 @@ def convert_to_markdown(output_data: dict) -> str:
emojis = {
"Main theme": "🎯",
"PR summary": "📝",
"Type of PR": "📌",
"Score": "🏅",
"Relevant tests added": "🧪",
"Unrelated changes": "⚠️",
"Focused PR": "",
"Security concerns": "🔒",
"General PR suggestions": "💡",
"General suggestions": "💡",
"Insights from user's answers": "📝",
"Code feedback": "🤖",
}
for key, value in output_data.items():
if not value:
if value is None:
continue
if isinstance(value, dict):
markdown_text += f"## {key}\n\n"
markdown_text += convert_to_markdown(value)
elif isinstance(value, list):
if key.lower() == 'code feedback':
markdown_text += "\n" # just looks nicer with additional line breaks
emoji = emojis.get(key, "")
markdown_text += f"- {emoji} **{key}:**\n\n"
if key.lower() == 'code feedback':
markdown_text += f"\n\n- **<details><summary> { emoji } Code feedback:**</summary>\n\n"
else:
markdown_text += f"- {emoji} **{key}:**\n\n"
for item in value:
if isinstance(item, dict) and key.lower() == 'code feedback':
markdown_text += parse_code_suggestion(item)
elif item:
markdown_text += f" - {item}\n"
if key.lower() == 'code feedback':
markdown_text += "</details>\n\n"
elif value != 'n/a':
emoji = emojis.get(key, "")
markdown_text += f"- {emoji} **{key}:** {value}\n"