diff --git a/pr_agent/algo/utils.py b/pr_agent/algo/utils.py index aeecd35b..603f9a2f 100644 --- a/pr_agent/algo/utils.py +++ b/pr_agent/algo/utils.py @@ -278,16 +278,17 @@ def convert_to_markdown_v2(output_data: dict, markdown_text += f"- {format_todo_item(value)}\n" return markdown_text - markdown_todo_items = format_todo_items(value) - EXPAND_LINE_THRESHOLD = 10 - details_open_attr = " open" if markdown_todo_items.count("\n") + 1 <= EXPAND_LINE_THRESHOLD else "" - - todo_entry_label = f"{len(value)} " + "entries" if len(value) > 1 else "entry" if gfm_supported: markdown_text += "" if is_value_no(value): markdown_text += f"{emoji} No TODO sections" else: + markdown_todo_items = format_todo_items(value) + + EXPAND_LINE_THRESHOLD = 10 + details_open_attr = " open" if markdown_todo_items.count("\n") + 1 <= EXPAND_LINE_THRESHOLD else "" + todo_entry_label = f"{len(value)} " + "entries" if len(value) > 1 else "entry" + markdown_text += f"{emoji} TODO sections ({todo_entry_label})\n" markdown_text += f"{todo_summary}\n\n" markdown_text += markdown_todo_items @@ -297,6 +298,12 @@ def convert_to_markdown_v2(output_data: dict, if is_value_no(value): markdown_text += f"### {emoji} No TODO sections\n\n" else: + markdown_todo_items = format_todo_items(value) + + EXPAND_LINE_THRESHOLD = 10 + details_open_attr = " open" if markdown_todo_items.count("\n") + 1 <= EXPAND_LINE_THRESHOLD else "" + todo_entry_label = f"{len(value)} " + "entries" if len(value) > 1 else "entry" + markdown_text += f"### {emoji} TODO sections ({todo_entry_label})\n{todo_summary}\n\n" markdown_text += markdown_todo_items markdown_text += "\n\n\n" diff --git a/pr_agent/settings/pr_reviewer_prompts.toml b/pr_agent/settings/pr_reviewer_prompts.toml index c96cac6e..88a134eb 100644 --- a/pr_agent/settings/pr_reviewer_prompts.toml +++ b/pr_agent/settings/pr_reviewer_prompts.toml @@ -108,7 +108,7 @@ class Review(BaseModel): security_concerns: str = Field(description="Does this PR code introduce possible vulnerabilities such as exposure of sensitive information (e.g., API keys, secrets, passwords), or security concerns like SQL injection, XSS, CSRF, and others ? Answer 'No' (without explaining why) if there are no possible issues. If there are security concerns or issues, start your answer with a short header, such as: 'Sensitive information exposure: ...', 'SQL injection: ...' etc. Explain your answer. Be specific and give examples if possible") {%- endif %} {%- if require_todo_scan %} - todo_sections: Union[List[TodoSection], str] = Field(description="A list of TODO comments found in the code. Return 'No' (as a string) if there are no TODO comments.") + todo_sections: Union[List[TodoSection], str] = Field(description="A list of TODO comments found in the code. Return 'No' (as a string) if there are no TODO comments or the list would be empty.") todo_summary: str = Field(description="Summarize the functional areas of the TODO comments found in the code. - Focus on describing the *functional areas* of the TODOs, such as: testing, error handling, validation, documentation, performance,