Review
Overview¶
The review
tool scans the PR code changes, and generates a list of feedbacks about the PR, aiming to aid the reviewing process.
The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on any PR:
Note that the main purpose of the review
tool is to provide the PR reviewer with useful feedbacks and insights. The PR author, in contrast, may prefer to save time and focus on the output of the improve tool, which provides actionable code suggestions.
(Read more about the different personas in the PR process and how Qodo Merge aims to assist them in our blog)
Example usage¶
Manual triggering¶
Invoke the tool manually by commenting /review
on any PR:
After ~30 seconds, the tool will generate a review for the PR:
If you want to edit configurations, add the relevant ones to the command:
Automatic triggering¶
To run the review
automatically when a PR is opened, define in a configuration file:
- The
pr_commands
lists commands that will be executed automatically when a PR is opened. - The
[pr_reviewer]
section contains the configurations for thereview
tool you want to edit (if any).
Configuration options¶
General options
persistent_comment | If set to true, the review comment will be persistent, meaning that every new review request will edit the previous one. Default is true. |
final_update_message | When set to true, updating a persistent review comment during online commenting will automatically add a short comment with a link to the updated review in the pull request .Default is true. |
extra_instructions | Optional extra instructions to the tool. For example: "focus on the changes in the file X. Ignore change in ...". |
enable_help_text | If set to true, the tool will display a help text in the comment. Default is true. |
num_max_findings | Number of maximum returned findings. Default is 3. |
Enable\disable specific sub-sections
require_score_review | If set to true, the tool will add a section that scores the PR. Default is false. |
require_tests_review | If set to true, the tool will add a section that checks if the PR contains tests. Default is true. |
require_estimate_effort_to_review | If set to true, the tool will add a section that estimates the effort needed to review the PR. Default is true. |
require_can_be_split_review | If set to true, the tool will add a section that checks if the PR contains several themes, and can be split into smaller PRs. Default is false. |
require_security_review | If set to true, the tool will add a section that checks if the PR contains a possible security or vulnerability issue. Default is true. |
require_ticket_analysis_review | If set to true, and the PR contains a GitHub or Jira ticket link, the tool will add a section that checks if the PR in fact fulfilled the ticket requirements. Default is true. |
Adding PR labels
You can enable\disable the review
tool to add specific labels to the PR:
enable_review_labels_security | If set to true, the tool will publish a 'possible security issue' label if it detects a security issue. Default is true. |
enable_review_labels_effort | If set to true, the tool will publish a 'Review effort x/5' label (1–5 scale). Default is true. |
Usage Tips¶
General guidelines¶
The review
tool provides a collection of configurable feedbacks about a PR.
It is recommended to review the Configuration options section, and choose the relevant options for your use case.
Some of the features that are disabled by default are quite useful, and should be considered for enabling. For example:
require_score_review
, and more.
On the other hand, if you find one of the enabled features to be irrelevant for your use case, disable it. No default configuration can fit all use cases.
Automation¶
When you first install Qodo Merge app, the default mode for the review
tool is:
review
tool will run automatically on every PR, without any additional configurations.
Edit this field to enable/disable the tool, or to change the configurations used.
Auto-generated PR labels from the Review Tool¶
The review
tool automatically adds two specific labels to your Pull Requests:
possible security issue
: This label is applied if the tool detects a potential security vulnerability in the PR's code. This feedback is controlled by the 'enable_review_labels_security' flag.review effort [x/5]
: This label estimates the effort required to review the PR on a relative scale of 1 to 5, where 'x' represents the assessed effort. This feedback is controlled by the 'enable_review_labels_effort' flag.
Note: The possible security issue
label highlights potential security risks. You can configure a GitHub Action to prevent merging PRs that have this label.
Extra instructions¶
Extra instructions are important.
The review
tool can be configured with extra instructions, which can be used to guide the model to a feedback tailored to the needs of your project.
Be specific, clear, and concise in the instructions. With extra instructions, you are the prompter. Specify the relevant sub-tool, and the relevant aspects of the PR that you want to emphasize.
Examples of extra instructions:
Use triple quotes to write multi-line instructions. Use bullet points to make the instructions more readable.