inline_code_comments

This commit is contained in:
mrT23
2023-07-13 09:44:33 +03:00
parent 4b8420aa16
commit 77a451ada0
6 changed files with 51 additions and 79 deletions

View File

@ -2,14 +2,14 @@
model="gpt-4-0613"
git_provider="github"
publish_review=true
verbosity_level=0 # 0,1,2
verbosity_level=0 # 0,1,2
[pr_reviewer]
require_focused_review=true
require_tests_review=true
require_security_review=true
extended_code_suggestions=false
num_code_suggestions=4
inline_code_comments = true
[pr_questions]

View File

@ -3,9 +3,6 @@ system="""You are CodiumAI-PR-Reviewer, a language model designed to review git
Your task is to provide constructive and concise feedback for the PR, and also provide meaningfull code suggestions to improve the new PR code (the '+' lines).
- Provide up to {{ num_code_suggestions }} code suggestions.
- Try to focus on important suggestions like fixing code problems, issues and bugs. As a second priority, provide suggestions for meaningfull code improvements, like performance, vulnerability, modularity, and best practices.
{%- if extended_code_suggestions %}
- For each suggestion, provide a short and concise code snippet to illustrate the existing code, and the improved code.
{%- endif %}
- Make sure not to provide suggestion repeating modifications already implemented in the new PR code (the '+' lines).
You must use the following JSON schema to format your answer:
@ -49,35 +46,16 @@ You must use the following JSON schema to format your answer:
"items": {
"relevant file": {
"type": "string",
"description": "the relevant file name"
"description": "the relevant file full path"
},
"suggestion content": {
"type": "string",
{%- if extended_code_suggestions %}
"description": "a concrete suggestion for meaningfully improving the new PR code. Don't repeat previous suggestions. Add tags with importance measure that matches each suggestion ('important' or 'medium'). Do not make suggestions for updating or adding docstrings, renaming PR title and description, or linter like.
{%- else %}
"description": "a concrete suggestion for meaningfully improving the new PR code. Also describe how, specifically, the suggestion can be applied to new PR code. Add tags with importance measure that matches each suggestion ('important' or 'medium'). Do not make suggestions for updating or adding docstrings, renaming PR title and description, or linter like.
{%- endif %}
},
{%- if extended_code_suggestions %}
"why": {
"relevant line in file": {
"type": "string",
"description": "shortly explain why this suggestion is important"
},
"code example": {
"type": "object",
"properties": {
"before code": {
"type": "string",
"description": "Short and concise code snippet, to illustrate the existing code"
},
"after code": {
"type": "string",
"description": "Short and concise code snippet, to illustrate the improved code"
}
}
"description": "an authentic single code line from the PR git diff section, to which the suggestion applies."
}
{%- endif %}
}
},
{%- if require_security %}
@ -111,16 +89,9 @@ Example output:
"General PR suggestions": "..., `xxx`...",
"Code suggestions": [
{
"relevant file": "xxx.py",
"relevant file": "directory/xxx.py",
"suggestion content": "xxx [important]",
{%- if extended_code_suggestions %}
"why": "xxx",
"code example":
{
"before code": "xxx",
"after code": "xxx"
}
{%- endif %}
"relevant line in file": "xxx",
},
...
]