Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Score Review Feature #89

Merged
merged 7 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ You can select your git_provider with the flag `git_provider` in the `config` se
You can enable/disable the different PR Reviewer abilities with the following flags (`pr_reviewer` section):
```
require_focused_review=true
require_score_review=true
require_tests_review=true
require_security_review=true
```
Expand Down
1 change: 1 addition & 0 deletions pr_agent/algo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def convert_to_markdown(output_data: dict) -> str:
emojis = {
"Main theme": "🎯",
"Type of PR": "📌",
"Score": "🏅",
zmeir marked this conversation as resolved.
Show resolved Hide resolved
"Relevant tests added": "🧪",
"Unrelated changes": "⚠️",
"Focused PR": "✨",
Expand Down
1 change: 1 addition & 0 deletions pr_agent/settings/configuration.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ verbosity_level=0 # 0,1,2

[pr_reviewer]
require_focused_review=true
require_score_review=true
mrT23 marked this conversation as resolved.
Show resolved Hide resolved
mrT23 marked this conversation as resolved.
Show resolved Hide resolved
require_tests_review=true
require_security_review=true
num_code_suggestions=3
Expand Down
6 changes: 6 additions & 0 deletions pr_agent/settings/pr_reviewer_prompts.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ You must use the following JSON schema to format your answer:
"type": "string",
"enum": ["Bug fix", "Tests", "Bug fix with tests", "Refactoring", "Enhancement", "Documentation", "Other"]
},
{%- if require_score %}
"Score": {
mrT23 marked this conversation as resolved.
Show resolved Hide resolved
mrT23 marked this conversation as resolved.
Show resolved Hide resolved
zmeir marked this conversation as resolved.
Show resolved Hide resolved
"type": "float",
"description": "Rate this PR on a scale of 0-100 (inclusive), where 0 means the worst possible code, and 100 means code of the highest quality without any bugs or performace issues that is ready to be merged immediately and run in production at scale."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"type": "float",
"description": "Rate this PR on a scale of 0-100 (inclusive), where 0 means the worst possible code, and 100 means code of the highest quality without any bugs or performace issues that is ready to be merged immediately and run in production at scale."
"type": "str",
"description": "Rate this PR on a scale of 0-100 (inclusive), where 0 means the worst possible PR code, and 100 means PR code of the highest quality, without any bugs or performance issues, that is ready to be merged immediately and run in production at scale. Explain shortly the reason for the score you gave."

},
{%- endif %}
{%- if require_tests %}
"Relevant tests added": {
"type": "string",
Expand Down
1 change: 1 addition & 0 deletions pr_agent/tools/pr_reviewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def __init__(self, pr_url: str, cli_mode=False, is_answer: bool = False):
"description": self.git_provider.get_pr_description(),
"language": self.main_language,
"diff": "", # empty diff for initial calculation
"require_score": settings.pr_reviewer.require_score_review,
mrT23 marked this conversation as resolved.
Show resolved Hide resolved
mrT23 marked this conversation as resolved.
Show resolved Hide resolved
mrT23 marked this conversation as resolved.
Show resolved Hide resolved
zmeir marked this conversation as resolved.
Show resolved Hide resolved
"require_tests": settings.pr_reviewer.require_tests_review,
"require_security": settings.pr_reviewer.require_security_review,
"require_focused": settings.pr_reviewer.require_focused_review,
Expand Down