-
Notifications
You must be signed in to change notification settings - Fork 585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancement of PR Description and Labeling Features with Semantic File Types and Line Count #509
Conversation
… git providers and PR description tools
…in pr_description.py and pr_description_prompts.toml
…mantic file labels
…mantic file labels
…ompts in pr_description_prompts.toml
PR Analysis
PR Feedback
How to useInstructions
|
PR Code Suggestions💡 Suggestion: Avoid using File: pr_agent/tools/pr_description.py (335-346) Example code:Existing code: try:
filename = file['filename'].replace("'", "`").replace('"', '`')
changes_summary = file['changes_summary']
label = file['label']
if label not in self.file_label_dict:
self.file_label_dict[label] = []
self.file_label_dict[label].append((filename, changes_summary))
except Exception as e:
get_logger().error(f"Error preparing file label dict {self.pr_id}: {e}")
pass Improved code: try:
filename = file['filename'].replace("'", "`").replace('"', '`')
changes_summary = file['changes_summary']
label = file['label']
if label not in self.file_label_dict:
self.file_label_dict[label] = []
self.file_label_dict[label].append((filename, changes_summary))
except Exception as e:
get_logger().error(f"Error preparing file label dict {self.pr_id}: {e}") 💡 Suggestion: Avoid hardcoding the URL. Consider using a configuration file or environment variables to store the base URL. File: pr_agent/git_providers/github_provider.py (514-521) Example code:Existing code: if relevant_line_start == -1:
link = f"https://github.com/{self.repo}/pull/{self.pr_num}/files#diff-{sha_file}"
elif relevant_line_end:
link = f"https://github.com/{self.repo}/pull/{self.pr_num}/files#diff-{sha_file}R{relevant_line_start}-R{relevant_line_end}"
else:
link = f"https://github.com/{self.repo}/pull/{self.pr_num}/files#diff-{sha_file}R{relevant_line_start}" Improved code: base_url = get_settings().github_base_url
if relevant_line_start == -1:
link = f"{base_url}/{self.repo}/pull/{self.pr_num}/files#diff-{sha_file}"
elif relevant_line_end:
link = f"{base_url}/{self.repo}/pull/{self.pr_num}/files#diff-{sha_file}R{relevant_line_start}-R{relevant_line_end}"
else:
link = f"{base_url}/{self.repo}/pull/{self.pr_num}/files#diff-{sha_file}R{relevant_line_start}" 💡 Suggestion: Use a multiline string for better readability. File: pr_agent/servers/help.py (1-11) Example code:Existing code: commands_text = "> **/review**: Request a review of your Pull Request. \n" \
"> **/describe**: Update the PR title and description based on the contents of the PR. \n" \
"> **/improve [--extended]**: Suggest code improvements. Extended mode provides a higher quality feedback. \n" \
"> **/ask \\<QUESTION\\>**: Ask a question about the PR. \n" \
"> **/update_changelog**: Update the changelog based on the PR's contents. \n" \
"> **/add_docs**: Generate docstring for new components introduced in the PR. \n" \
"> **/generate_labels**: Generate labels for the PR based on the PR's contents. \n" \
"> see the [tools guide](https://github.com/Codium-ai/pr-agent/blob/main/docs/TOOLS_GUIDE.md) for more details.\n\n" \
">To edit any configuration parameter from the [configuration.toml](https://github.com/Codium-ai/pr-agent/blob/main/pr_agent/settings/configuration.toml), add --config_path=new_value. \n" \
">For example: /review --pr_reviewer.extra_instructions=\"focus on the file: ...\" \n" \
">To list the possible configuration parameters, add a **/config** comment. \n" Improved code: commands_text = """
> **/review**: Request a review of your Pull Request.
> **/describe**: Update the PR title and description based on the contents of the PR.
> **/improve [--extended]**: Suggest code improvements. Extended mode provides a higher quality feedback.
> **/ask \\<QUESTION\\>**: Ask a question about the PR.
> **/update_changelog**: Update the changelog based on the PR's contents.
> **/add_docs**: Generate docstring for new components introduced in the PR.
> **/generate_labels**: Generate labels for the PR based on the PR's contents.
> see the [tools guide](https://github.com/Codium-ai/pr-agent/blob/main/docs/TOOLS_GUIDE.md) for more details.
>To edit any configuration parameter from the [configuration.toml](https://github.com/Codium-ai/pr-agent/blob/main/pr_agent/settings/configuration.toml), add --config_path=new_value.
>For example: /review --pr_reviewer.extra_instructions=\"focus on the file: ...\"
>To list the possible configuration parameters, add a **/config** comment.
""" 💡 Suggestion: Use a more descriptive name for the configuration parameter. File: pr_agent/settings/configuration.toml (49-50) Example code:Existing code: enable_file_walkthrough=false
enable_semantic_files_types=true Improved code: enable_file_changes_walkthrough=false
enable_semantic_file_change_types=true |
/describe |
PR Description updated to latest commit (a61e492) |
…nded Enhancement of PR Description and Labeling Features
Type
Enhancement
Description
This PR introduces several enhancements and changes to the PR description and labeling features:
PR changes walkthrough
7 files
pr_description.py
pr_agent/tools/pr_description.py
Added the ability to include a file walkthrough and semantic
file types in the PR description. Also, added the ability to
count the number of lines added and removed in a file patch.
help.py
pr_agent/servers/help.py
Improved the formatting of help command descriptions.
github_provider.py
pr_agent/git_providers/github_provider.py
Enhanced link generation for relevant lines in GitHub
provider.
gitlab_provider.py
pr_agent/git_providers/gitlab_provider.py
Enhanced link generation for relevant lines in GitLab
provider.
utils.py
pr_agent/algo/utils.py
Removed 'Refactoring' from the list of default labels.
bitbucket_provider.py
pr_agent/git_providers/bitbucket_provider.py
Enhanced link generation for relevant lines in Bitbucket
provider.
git_provider.py
pr_agent/git_providers/git_provider.py
Added fields to count the number of lines added and removed
in a file patch.
3 files
pr_description_prompts.toml
pr_agent/settings/pr_description_prompts.toml
Updated the prompts for clarity and to reflect the new
features.
configuration.toml
pr_agent/settings/configuration.toml
Updated the settings to enable or disable the new PR
description features.
custom_labels.toml
pr_agent/settings/custom_labels.toml
Removed 'Refactoring' from the list of custom labels.