Skip to content

Commit

Permalink
Merge pull request #732 from Codium-ai/tr/remove_outdated_option
Browse files Browse the repository at this point in the history
Remove functionality and references to 'remove_previous_review_comment'
  • Loading branch information
mrT23 authored Mar 3, 2024
2 parents 5500d35 + f1bd67b commit 68fab0b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 14 deletions.
8 changes: 2 additions & 6 deletions Usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
1 change: 0 additions & 1 deletion docs/REVIEW.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion pr_agent/settings/configuration.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 2 additions & 6 deletions pr_agent/tools/pr_reviewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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:
Expand Down Expand Up @@ -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,
Expand All @@ -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}")
Expand Down

0 comments on commit 68fab0b

Please sign in to comment.