diff --git a/docs/docs/core-abilities/auto_approval.md b/docs/docs/core-abilities/auto_approval.md new file mode 100644 index 00000000..9dffb134 --- /dev/null +++ b/docs/docs/core-abilities/auto_approval.md @@ -0,0 +1,83 @@ + + +> `💎 feature. Platforms supported: GitHub, GitLab, Bitbucket` + +Under specific conditions, Qodo Merge can auto-approve a PR when a manual comment is invoked, or when the PR meets certain criteria. + +**To ensure safety, the auto-approval feature is disabled by default.** +To enable auto-approval features, you need to actively set one or both of the following options in a pre-defined _configuration file_: + +```toml +[config] +enable_comment_approval = true # For approval via comments +enable_auto_approval = true # For criteria-based auto-approval +``` + +!!! note "Notes" + - These flags above cannot be set with a command line argument, only in the configuration file, committed to the repository. + - Enabling auto-approval must be a deliberate decision by the repository owner. + +## **Approval by commenting** + +To enable approval by commenting, set in the configuration file: + +```toml +[config] +enable_comment_approval = true +``` + +After enabling, by commenting on a PR: + +``` +/review auto_approve +``` + +Qodo Merge will approve the PR and add a comment with the reason for the approval. + +## **Auto-approval when the PR meets certain criteria** + +To enable auto-approval based on specific criteria, first, you need to enable the top-level flag: + +```toml +[config] +enable_auto_approval = true +``` + +There are two possible paths leading to this auto-approval - one via the `review` tool, and one via the `improve` tool. Each tool can independently trigger auto-approval. + +### Auto-approval via the `review` tool + +- **Review effort score criteria** + + ```toml + [config] + enable_auto_approval = true + auto_approve_for_low_review_effort = X # X is a number between 1 and 5 + ``` + + When the [review effort score](https://www.qodo.ai/images/pr_agent/review3.png) is lower than or equal to X, the PR will be auto-approved (unless ticket compliance is enabled and fails, see below). + +- **Ticket compliance criteria** + + ```toml + [config] + enable_auto_approval = true + ensure_ticket_compliance = true # Default is false + ``` + + If `ensure_ticket_compliance` is set to `true`, auto-approval will be disabled if no ticket is linked to the PR, or if the PR is not fully compliant with a linked ticket. This ensures that PRs are only auto-approved if their associated tickets are properly resolved. + + You can also prevent auto-approval if the PR exceeds the ticket's scope (see [here](https://qodo-merge-docs.qodo.ai/core-abilities/fetching_ticket_context/#configuration-options)). + + +### Auto-approval via the `improve` tool + +PRs can be auto-approved when the `improve` tool doesn't find code suggestions. +To enable this feature, set the following in the configuration file: + +```toml +[config] +enable_auto_approval = true +auto_approve_for_no_suggestions = true +``` + diff --git a/docs/docs/core-abilities/index.md b/docs/docs/core-abilities/index.md index 8e07f24f..92f00151 100644 --- a/docs/docs/core-abilities/index.md +++ b/docs/docs/core-abilities/index.md @@ -14,6 +14,7 @@ Qodo Merge utilizes a variety of core abilities to provide a comprehensive and e - [Local and global metadata](https://qodo-merge-docs.qodo.ai/core-abilities/metadata/) - [RAG context enrichment](https://qodo-merge-docs.qodo.ai/core-abilities/rag_context_enrichment/) - [Self-reflection](https://qodo-merge-docs.qodo.ai/core-abilities/self_reflection/) +- [Auto approval](https://qodo-merge-docs.qodo.ai/core-abilities/auto_approval/) - [Static code analysis](https://qodo-merge-docs.qodo.ai/core-abilities/static_code_analysis/) ## Blogs diff --git a/docs/docs/tools/improve.md b/docs/docs/tools/improve.md index 70cec345..05aefa28 100644 --- a/docs/docs/tools/improve.md +++ b/docs/docs/tools/improve.md @@ -483,86 +483,6 @@ code_suggestions_self_review_text = "... (your text here) ..." To prevent unauthorized approvals, this configuration defaults to false, and cannot be altered through online comments; enabling requires a direct update to the configuration file and a commit to the repository. This ensures that utilizing the feature demands a deliberate documented decision by the repository owner. -### Auto-approval - -> `💎 feature. Platforms supported: GitHub, GitLab, Bitbucket` - -Under specific conditions, Qodo Merge can auto-approve a PR when a specific comment is invoked, or when the PR meets certain criteria. - -**To ensure safety, the auto-approval feature is disabled by default.** -To enable auto-approval features, you need to actively set one or both of the following options in a pre-defined _configuration file_: - -```toml -[config] -enable_comment_approval = true # For approval via comments -enable_auto_approval = true # For criteria-based auto-approval -``` - -!!! note "Notes" - - Note that this specific flag cannot be set with a command line argument, only in the configuration file, committed to the repository. - - Enabling auto-approval must be a deliberate decision by the repository owner. - -1\. **Auto-approval by commenting** - -To enable auto-approval by commenting, set in the configuration file: - -```toml -[config] -enable_comment_approval = true -``` - -After enabling, by commenting on a PR: - -``` -/review auto_approve -``` - -Qodo Merge will automatically approve the PR, and add a comment with the approval. - -2\. **Auto-approval when the PR meets certain criteria** - -To enable auto-approval based on specific criteria, first, you need to enable the top-level flag: - -```toml -[config] -enable_auto_approval = true -``` - -There are several criteria that can be set for auto-approval: - -- **Review effort score** - -```toml -[config] -enable_auto_approval = true -auto_approve_for_low_review_effort = X # X is a number between 1 to 5 -``` - -When the [review effort score](https://www.qodo.ai/images/pr_agent/review3.png) is lower or equal to X, the PR will be auto-approved. - -___ - -- **No code suggestions** - -```toml -[config] -enable_auto_approval = true -auto_approve_for_no_suggestions = true -``` - -When no [code suggestions](https://www.qodo.ai/images/pr_agent/code_suggestions_as_comment_closed.png) were found for the PR, the PR will be auto-approved. - -___ - -- **Ticket Compliance** - -```toml -[config] -enable_auto_approval = true -ensure_ticket_compliance = true # Default is false -``` - -If `ensure_ticket_compliance` is set to `true`, auto-approval will be disabled if a ticket is linked to the PR and the ticket is not compliant (e.g., the `review` tool did not mark the PR as fully compliant with the ticket). This ensures that PRs are only auto-approved if their associated tickets are properly resolved. ### How many code suggestions are generated? diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 6210ed1c..b0ba0172 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -55,6 +55,7 @@ nav: - Local and global metadata: 'core-abilities/metadata.md' - RAG context enrichment: 'core-abilities/rag_context_enrichment.md' - Self-reflection: 'core-abilities/self_reflection.md' + - Auto-approval: 'core-abilities/auto_approval.md' - Static code analysis: 'core-abilities/static_code_analysis.md' - Chrome Extension: - Qodo Merge Chrome Extension: 'chrome-extension/index.md'