From f1bd67b7e9f80d400c7e5f891ff28792143c418d Mon Sep 17 00:00:00 2001 From: mrT23 Date: Sun, 3 Mar 2024 11:24:30 +0200 Subject: [PATCH] Remove functionality and references to 'remove_previous_review_comment' option --- Usage.md | 8 ++------ docs/REVIEW.md | 1 - pr_agent/settings/configuration.toml | 1 - pr_agent/tools/pr_reviewer.py | 8 ++------ 4 files changed, 4 insertions(+), 14 deletions(-) diff --git a/Usage.md b/Usage.md index 99565494d..d221fb92a 100644 --- a/Usage.md +++ b/Usage.md @@ -212,14 +212,10 @@ The configuration parameter `push_commands` defines the list of tools that will handle_push_trigger = true push_commands = [ "/describe --pr_description.add_original_user_description=true --pr_description.keep_original_user_title=true", - "/review -i --pr_reviewer.remove_previous_review_comment=true", + "/review --pr_reviewer.num_code_suggestions=0", ] ``` -This means that when new code is pushed to the PR, the PR-Agent will run the `describe` and incremental `review` tools. -For the `describe` tool, the `add_original_user_description` and `keep_original_user_title` parameters will be set to true. -For the `review` tool, it will run in incremental mode, and the `remove_previous_review_comment` parameter will be set to true. - -Much like the configurations for `pr_commands`, you can override the default tool parameters by uploading a local configuration file to the root of your repo. +This means that when new code is pushed to the PR, the PR-Agent will run the `describe` and `review` tools, with the specified parameters. ### Working with GitHub Action `GitHub Action` is a different way to trigger PR-Agent tools, and uses a different configuration mechanism than `GitHub App`. diff --git a/docs/REVIEW.md b/docs/REVIEW.md index 8160c0a96..39783c483 100644 --- a/docs/REVIEW.md +++ b/docs/REVIEW.md @@ -77,7 +77,6 @@ For example, if `minimal_commits_for_incremental_review=2` and `minimal_minutes_ When `require_all_thresholds_for_incremental_review=true` the incremental review __will not__ run, because only 1 out of 2 conditions were met (we have enough commits but the last review is too recent), but when `require_all_thresholds_for_incremental_review=false` the incremental review __will__ run, because one condition is enough (we have 3 commits which is more than the configured 2). Default is false - the tool will run as long as at least once conditions is met. -- `remove_previous_review_comment`: if set to true, the tool will remove the previous review comment before adding a new one. Default is false. ### PR Reflection By invoking: diff --git a/pr_agent/settings/configuration.toml b/pr_agent/settings/configuration.toml index 636deb623..0f2dab3cb 100644 --- a/pr_agent/settings/configuration.toml +++ b/pr_agent/settings/configuration.toml @@ -34,7 +34,6 @@ num_code_suggestions=4 inline_code_comments = false ask_and_reflect=false #automatic_review=true -remove_previous_review_comment=false persistent_comment=true extra_instructions = "" # review labels diff --git a/pr_agent/tools/pr_reviewer.py b/pr_agent/tools/pr_reviewer.py index 0eabc59b4..f73e20f2d 100644 --- a/pr_agent/tools/pr_reviewer.py +++ b/pr_agent/tools/pr_reviewer.py @@ -119,8 +119,6 @@ async def run(self) -> None: get_logger().debug(f"PR output", artifact=pr_review) if get_settings().config.publish_output: - previous_review_comment = self._get_previous_review_comment() - # publish the review if get_settings().pr_reviewer.persistent_comment and not self.incremental.is_incremental: self.git_provider.publish_persistent_comment(pr_review, @@ -130,8 +128,6 @@ async def run(self) -> None: self.git_provider.publish_comment(pr_review) self.git_provider.remove_initial_comment() - if previous_review_comment: - self._remove_previous_review_comment(previous_review_comment) if get_settings().pr_reviewer.inline_code_comments: self._publish_inline_code_comments() except Exception as e: @@ -295,7 +291,7 @@ def _get_previous_review_comment(self): Get the previous review comment if it exists. """ try: - if get_settings().pr_reviewer.remove_previous_review_comment and hasattr(self.git_provider, "get_previous_review"): + if hasattr(self.git_provider, "get_previous_review"): return self.git_provider.get_previous_review( full=not self.incremental.is_incremental, incremental=self.incremental.is_incremental, @@ -308,7 +304,7 @@ def _remove_previous_review_comment(self, comment): Remove the previous review comment if it exists. """ try: - if get_settings().pr_reviewer.remove_previous_review_comment and comment: + if comment: self.git_provider.remove_comment(comment) except Exception as e: get_logger().exception(f"Failed to remove previous review comment, error: {e}")