feat: add TODO comments to PR review output

This commit is contained in:
joosomi
2025-05-24 01:52:52 +09:00
parent 4e80f3999c
commit 788c0c12e6
5 changed files with 73 additions and 1 deletions

View File

@ -77,6 +77,7 @@ require_tests_review=true
require_estimate_effort_to_review=true
require_can_be_split_review=false
require_security_review=true
require_todo_scan=true
require_ticket_analysis_review=true
# general options
persistent_comment=true

View File

@ -72,6 +72,11 @@ class KeyIssuesComponentLink(BaseModel):
start_line: int = Field(description="The start line that corresponds to this issue in the relevant file")
end_line: int = Field(description="The end line that corresponds to this issue in the relevant file")
class TodoSection(BaseModel):
relevant_file: str = Field(description="The file containing the TODO comment")
line_number: int = Field(description="The line number of the TODO comment")
content: str = Field(description="The content of the TODO comment. Only include items that are actual TODO comments inside code comments (e.g., lines starting with #, //, /*, <!--, etc). Remove any leading 'TODO' or similar prefix from the content, but do include lines like '# TODO' even if they result in empty content after prefix removal. Do not include TODOs that are not in comments or not prefixed appropriately.")
{%- if related_tickets %}
class TicketCompliance(BaseModel):
@ -102,6 +107,9 @@ class Review(BaseModel):
{%- if require_security_review %}
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: List[TodoSection] = Field(description="A list of TODO comments found in the code. Return an empty list if there are no TODO comments.")
{%- endif %}
{%- if require_can_be_split_review %}
can_be_split: List[SubPR] = Field(min_items=0, max_items=3, description="Can this PR, which contains {{ num_pr_files }} changed files in total, be divided into smaller sub-PRs with distinct tasks that can be reviewed and merged independently, regardless of the order ? Make sure that the sub-PRs are indeed independent, with no code dependencies between them, and that each sub-PR represent a meaningful independent task. Output an empty list if the PR code does not need to be split.")
{%- endif %}
@ -148,6 +156,12 @@ review:
- ...
security_concerns: |
No
todo_sections:
- relevant_file: |
src/file1.py
line_number: 13
content: |
...
{%- if require_can_be_split_review %}
can_be_split:
- relevant_files:
@ -266,6 +280,12 @@ review:
- ...
security_concerns: |
No
todo_sections:
- relevant_file: |
...
line_number: ...
content: |
...
{%- if require_can_be_split_review %}
can_be_split:
- relevant_files: