final update message in PR description#499
Conversation
…in PR description
PR Analysis
PR Feedback
How to useInstructions
|
|
PR Description updated to latest commit (586785f) |
PR Code Suggestions💡 Suggestion: Consider initializing File: pr_agent/git_providers/codecommit_provider.py (61-66) Example code:Existing code: self.pr = None
self.diff_files = None
self.git_files = None
self.pr_url = pr_url
if pr_url:
self.set_pr(pr_url)Improved code: self.pr = None
self.diff_files = None
self.git_files = None
self.pr_url = pr_url
if pr_url:
self.set_pr(pr_url)💡 Suggestion: Consider adding a condition to check if File: pr_agent/git_providers/gerrit_provider.py (192-196) Example code:Existing code: self.repo = Repo(self.repo_path)
assert self.repo
self.pr_url = base_url
self.pr = PullRequestMimic(self.get_pr_title(), self.get_diff_files())Improved code: self.repo = Repo(self.repo_path)
assert self.repo
if base_url:
self.pr_url = base_url
self.pr = PullRequestMimic(self.get_pr_title(), self.get_diff_files())💡 Suggestion: Consider adding a comment to explain the purpose of the new code block for better readability. File: pr_agent/tools/pr_description.py (103-108) Example code:Existing code: if (get_settings().pr_description.final_update_message and
hasattr(self.git_provider, 'pr_url') and self.git_provider.pr_url):
latest_commit_url = self.git_provider.get_latest_commit_url()
if latest_commit_url:
self.git_provider.publish_comment(
f"**[PR Description]({self.git_provider.pr_url})** updated to latest commit ({latest_commit_url})")Improved code: # If final update message is enabled and the git provider has a PR URL, publish a comment with the PR description and latest commit URL
if (get_settings().pr_description.final_update_message and
hasattr(self.git_provider, 'pr_url') and self.git_provider.pr_url):
latest_commit_url = self.git_provider.get_latest_commit_url()
if latest_commit_url:
self.git_provider.publish_comment(
f"**[PR Description]({self.git_provider.pr_url})** updated to latest commit ({latest_commit_url})")💡 Suggestion: Consider adding a comment to explain the purpose of the new configuration option File: pr_agent/settings/configuration.toml (46-49) Example code:Existing code: use_bullet_points=true
extra_instructions = ""
enable_pr_type=true
final_update_message = trueImproved code: use_bullet_points=true
extra_instructions = ""
enable_pr_type=true
# If set to true, a final update message will be published in the PR description
final_update_message = true |
final update message in PR description
type:
enhancement
description:
This PR introduces several enhancements to the project:
pr_urlattribute has been added to the git providers (codecommit_provider.py,gerrit_provider.py,github_provider.py,gitlab_provider.py). This attribute stores the URL of the pull request.pr_description.pyfile has been updated to publish a final update message in the PR description if thefinal_update_messagesetting is enabled and thepr_urlattribute is present and valid. The message includes a link to the PR description and the latest commit.configuration.tomlfile has been updated to include a new settingfinal_update_messagewhich is set to true by default. This setting controls whether the final update message is published in the PR description.main_files_walkthrough:
files:
pr_agent/git_providers/codecommit_provider.py: Addedpr_urlattribute to store the URL of the pull request.pr_agent/git_providers/gerrit_provider.py: Addedpr_urlattribute to store the base URL.pr_agent/git_providers/github_provider.py: Addedpr_urlattribute to store the URL of the pull request if 'pull' is present in the URL.pr_agent/git_providers/gitlab_provider.py: Addedpr_urlattribute to store the merge request URL.pr_agent/tools/pr_description.py: Updated to publish a final update message in the PR description iffinal_update_messagesetting is enabled andpr_urlattribute is present and valid.pr_agent/settings/configuration.toml: Added a new settingfinal_update_messagewhich is set to true by default. This setting controls whether the final update message is published in the PR description.Example: