diff --git a/pr_agent/algo/utils.py b/pr_agent/algo/utils.py
index 9fab73ec..93b6b543 100644
--- a/pr_agent/algo/utils.py
+++ b/pr_agent/algo/utils.py
@@ -181,7 +181,7 @@ def convert_to_markdown_v2(output_data: dict,
if is_value_no(value):
markdown_text += f'### {emoji} No relevant tests\n\n'
else:
- markdown_text += f"### PR contains tests\n\n"
+ markdown_text += f"### {emoji} PR contains tests\n\n"
elif 'ticket compliance check' in key_nice.lower():
markdown_text = ticket_markdown_logic(emoji, markdown_text, value, gfm_supported)
elif 'security concerns' in key_nice.lower():
@@ -234,33 +234,24 @@ def convert_to_markdown_v2(output_data: dict,
end_line = int(str(issue.get('end_line', 0)).strip())
relevant_lines_str = extract_relevant_lines_str(end_line, files, relevant_file, start_line)
- reference_link = git_provider.get_line_link(relevant_file, start_line, end_line)
+ if git_provider:
+ reference_link = git_provider.get_line_link(relevant_file, start_line, end_line)
+ else:
+ reference_link = None
if gfm_supported:
- if get_settings().pr_reviewer.extra_issue_links:
- issue_content_linked = copy.deepcopy(issue_content)
- referenced_variables_list = issue.get('referenced_variables', [])
- for component in referenced_variables_list:
- name = component['variable_name'].strip().strip('`')
-
- ind = issue_content.find(name)
- if ind != -1:
- reference_link_component = git_provider.get_line_link(relevant_file, component[
- 'relevant_line'], component['relevant_line'])
- issue_content_linked = issue_content_linked[
- :ind - 1] + f"[`{name}`]({reference_link_component})" + issue_content_linked[
- ind + len(
- name) + 1:]
- else:
- get_logger().info(
- f"Failed to find variable in issue content: {component['variable_name'].strip()}")
- issue_content = issue_content_linked
- if relevant_lines_str:
- issue_str = f"{issue_header}\n\n{issue_content}
\n\n{relevant_lines_str}\n\n "
+ if reference_link is not None and len(reference_link) > 0:
+ if relevant_lines_str:
+ issue_str = f"{issue_header}\n\n{issue_content}
\n\n{relevant_lines_str}\n\n "
+ else:
+ issue_str = f"{issue_header}
{issue_content}"
else:
- issue_str = f"{issue_header}
{issue_content}"
+ issue_str = f"{issue_header}
{issue_content}"
else:
- issue_str = f"[**{issue_header}**]({reference_link})\n\n{issue_content}\n\n"
+ if reference_link is not None and len(reference_link) > 0:
+ issue_str = f"[**{issue_header}**]({reference_link})\n\n{issue_content}\n\n"
+ else:
+ issue_str = f"**{issue_header}**\n\n{issue_content}\n\n"
markdown_text += f"{issue_str}\n\n"
except Exception as e:
get_logger().exception(f"Failed to process 'Recommended focus areas for review': {e}")
diff --git a/pr_agent/settings/pr_reviewer_prompts.toml b/pr_agent/settings/pr_reviewer_prompts.toml
index a8c02c2c..1822fe14 100644
--- a/pr_agent/settings/pr_reviewer_prompts.toml
+++ b/pr_agent/settings/pr_reviewer_prompts.toml
@@ -81,7 +81,7 @@ class SubPR(BaseModel):
class KeyIssuesComponentLink(BaseModel):
relevant_file: str = Field(description="The full file path of the relevant file")
issue_header: str = Field(description="One or two word title for the the issue. For example: 'Possible Bug', 'Performance Issue', 'Code Smell', etc.")
- issue_content: str = Field(description="A short and concise summary of what should be further inspected and validated during the PR review process for this issue. Don't state line numbers here")
+ issue_content: str = Field(description="A short and concise summary of what should be further inspected and validated during the PR review process for this issue. Do not reference line numbers in this field.")
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")
@@ -111,7 +111,7 @@ class Review(BaseModel):
{%- if question_str %}
insights_from_user_answers: str = Field(description="shortly summarize the insights you gained from the user's answers to the questions")
{%- endif %}
- key_issues_to_review: List[KeyIssuesComponentLink] = Field("A diverse list of high-priority bugs, problems or performance concerns introduced in the PR code, which the PR reviewer should further focus on and validate during the review process.")
+ key_issues_to_review: List[KeyIssuesComponentLink] = Field("A short and diverse list (0-3 issues) of high-priority bugs, problems or performance concerns introduced in the PR code, which the PR reviewer should further focus on and validate during the review process.")
{%- 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 %}