From 762a6981e17125c9cfadd3cc239d8d351c708183 Mon Sep 17 00:00:00 2001 From: mrT23 Date: Wed, 15 Nov 2023 14:12:59 +0200 Subject: [PATCH] extra_labels --- docs/REVIEW.md | 3 +++ pr_agent/settings/configuration.toml | 3 ++- pr_agent/tools/pr_reviewer.py | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/REVIEW.md b/docs/REVIEW.md index 82eef6c3..533ac466 100644 --- a/docs/REVIEW.md +++ b/docs/REVIEW.md @@ -29,6 +29,9 @@ Under the section 'pr_reviewer', the [configuration file](./../pr_agent/settings - `remove_previous_review_comment`: if set to true, the tool will remove the previous review comment before adding a new one. Default is false. - `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. - `extra_instructions`: Optional extra instructions to the tool. For example: "focus on the changes in the file X. Ignore change in ...". +#### review labels +- `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 [1-5]: x' label. Default is false. - To enable `custom labels`, apply the configuration changes described [here](./GENERATE_CUSTOM_LABELS.md#configuration-changes) #### Incremental Mode For an incremental review, which only considers changes since the last PR-Agent review, this can be useful when working on the PR in an iterative manner, and you want to focus on the changes since the last review instead of reviewing the entire PR again, the following command can be used: diff --git a/pr_agent/settings/configuration.toml b/pr_agent/settings/configuration.toml index a27b15ab..da69ad8e 100644 --- a/pr_agent/settings/configuration.toml +++ b/pr_agent/settings/configuration.toml @@ -16,12 +16,13 @@ secret_provider="google_cloud_storage" cli_mode=false [pr_reviewer] # /review # +# enable/disable features require_focused_review=false require_score_review=false require_tests_review=true require_security_review=true require_estimate_effort_to_review=true -# +# general options num_code_suggestions=4 inline_code_comments = false ask_and_reflect=false diff --git a/pr_agent/tools/pr_reviewer.py b/pr_agent/tools/pr_reviewer.py index cf5c9497..525bc128 100644 --- a/pr_agent/tools/pr_reviewer.py +++ b/pr_agent/tools/pr_reviewer.py @@ -387,10 +387,10 @@ class PRReviewer: if get_settings().pr_reviewer.enable_review_labels_effort: estimated_effort = data['PR Analysis']['Estimated effort to review [1-5]'] estimated_effort_number = int(estimated_effort.split(',')[0]) - if 1 <= estimated_effort_number <= 5: + if 1 <= estimated_effort_number <= 5: # 1, because ... review_labels.append(f'Review effort [1-5]: {estimated_effort_number}') if get_settings().pr_reviewer.enable_review_labels_security: - security_concerns = data['PR Analysis']['Security concerns'] + security_concerns = data['PR Analysis']['Security concerns'] # yes, because ... security_concerns_bool = 'yes' in security_concerns.lower() or 'true' in security_concerns.lower() if security_concerns_bool: review_labels.append('Possible security concern')