mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-02 11:50:37 +08:00
refactor: simplify review effort label format and remove maximal effort limit
This commit is contained in:
@ -123,10 +123,6 @@ If enabled, the `review` tool can approve a PR when a specific comment, `/review
|
||||
<td><b>enable_auto_approval</b></td>
|
||||
<td>If set to true, the tool will approve the PR when invoked with the 'auto_approve' command. Default is false. This flag can be changed only from a configuration file.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>maximal_review_effort</b></td>
|
||||
<td>Maximal effort level for auto-approval. If the PR's estimated review effort is above this threshold, the auto-approval will not run. Default is 5.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
## Usage Tips
|
||||
@ -198,12 +194,6 @@ If enabled, the `review` tool can approve a PR when a specific comment, `/review
|
||||
Qodo Merge will automatically approve the PR, and add a comment with the approval.
|
||||
|
||||
|
||||
You can also enable auto-approval only if the PR meets certain requirements, such as that the `estimated_review_effort` label is equal or below a certain threshold, by adjusting the flag:
|
||||
```
|
||||
[pr_reviewer]
|
||||
maximal_review_effort = 5
|
||||
```
|
||||
|
||||
!!! tip "Code suggestions"
|
||||
|
||||
The `review` tool previously included a legacy feature for providing code suggestions (controlled by `--pr_reviewer.num_code_suggestion`). This functionality has been deprecated and replaced by the [`improve`](./improve.md) tool, which offers higher quality and more actionable code suggestions.
|
||||
|
@ -71,7 +71,6 @@ enable_intro_text=true
|
||||
enable_help_text=false # Determines whether to include help text in the PR review. Enabled by default.
|
||||
# auto approval
|
||||
enable_auto_approval=false
|
||||
maximal_review_effort=5
|
||||
|
||||
|
||||
[pr_description] # /describe #
|
||||
|
@ -371,7 +371,7 @@ class PRReviewer:
|
||||
else:
|
||||
get_logger().warning(f"Unexpected type for estimated_effort: {type(estimated_effort)}")
|
||||
if 1 <= estimated_effort_number <= 5: # 1, because ...
|
||||
review_labels.append(f'Review effort [1-5]: {estimated_effort_number}')
|
||||
review_labels.append(f'Review effort: {estimated_effort_number}/5')
|
||||
if get_settings().pr_reviewer.enable_review_labels_security and get_settings().pr_reviewer.require_security_review:
|
||||
security_concerns = data['review']['security_concerns'] # yes, because ...
|
||||
security_concerns_bool = 'yes' in security_concerns.lower() or 'true' in security_concerns.lower()
|
||||
@ -384,7 +384,7 @@ class PRReviewer:
|
||||
get_logger().debug(f"Current labels:\n{current_labels}")
|
||||
if current_labels:
|
||||
current_labels_filtered = [label for label in current_labels if
|
||||
not label.lower().startswith('review effort [1-5]:') and not label.lower().startswith(
|
||||
not label.lower().startswith('review effort:') and not label.lower().startswith(
|
||||
'possible security concern')]
|
||||
else:
|
||||
current_labels_filtered = []
|
||||
@ -402,20 +402,6 @@ class PRReviewer:
|
||||
Auto-approve a pull request if it meets the conditions for auto-approval.
|
||||
"""
|
||||
if get_settings().pr_reviewer.enable_auto_approval:
|
||||
maximal_review_effort = get_settings().pr_reviewer.maximal_review_effort
|
||||
if maximal_review_effort < 5:
|
||||
current_labels = self.git_provider.get_pr_labels()
|
||||
for label in current_labels:
|
||||
if label.lower().startswith('review effort [1-5]:'):
|
||||
effort = int(label.split(':')[1].strip())
|
||||
if effort > maximal_review_effort:
|
||||
get_logger().info(
|
||||
f"Auto-approve error: PR review effort ({effort}) is higher than the maximal review effort "
|
||||
f"({maximal_review_effort}) allowed")
|
||||
self.git_provider.publish_comment(
|
||||
f"Auto-approve error: PR review effort ({effort}) is higher than the maximal review effort "
|
||||
f"({maximal_review_effort}) allowed")
|
||||
return
|
||||
is_auto_approved = self.git_provider.auto_approve()
|
||||
if is_auto_approved:
|
||||
get_logger().info("Auto-approved PR")
|
||||
|
Reference in New Issue
Block a user