Skip to content
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

Use commit messages in PR tools #168

Merged
merged 2 commits into from
Aug 3, 2023
Merged

Conversation

mrT23
Copy link
Collaborator

@mrT23 mrT23 commented Aug 2, 2023

PR Type:

Enhancement


PR Description:

This PR updates several tools in the pr_agent package to use the commit messages in their functionality. The commit messages are now retrieved and stored in the vars dictionary for each tool.


PR Main Files Walkthrough:

  • pr_agent/tools/pr_code_suggestions.py: Added the commit_messages_str key to the vars dictionary.
  • pr_agent/tools/pr_description.py: Removed the commit_messages_str variable and added the commit_messages_str key to the vars dictionary.
  • pr_agent/tools/pr_information_from_user.py: Added the commit_messages_str key to the vars dictionary.
  • pr_agent/tools/pr_questions.py: Added the commit_messages_str key to the vars dictionary.
  • pr_agent/tools/pr_reviewer.py: Added the commit_messages_str key to the vars dictionary.
  • pr_agent/tools/pr_update_changelog.py: Added the commit_messages_str key to the vars dictionary.
  • pr_agent/settings/pr_code_suggestions_prompts.toml: Added a section to display the commit messages.
  • pr_agent/settings/pr_information_from_user_prompts.toml: Added a section to display the commit messages.
  • pr_agent/settings/pr_questions_prompts.toml: Added a section to display the commit messages.
  • pr_agent/settings/pr_reviewer_prompts.toml: Added a section to display the commit messages.
  • pr_agent/settings/pr_update_changelog_prompts.toml: Added a section to display the commit messages.

@mrT23 mrT23 requested a review from okotek August 2, 2023 15:29
@github-actions
Copy link
Contributor

github-actions bot commented Aug 2, 2023

PR Analysis

  • 🎯 Main theme: Refactoring the code to use 'commit_messages_str' in all tools
  • 📌 Type of PR: Refactoring
  • 🧪 Relevant tests added: No
  • Focused PR: Yes, the PR is focused as it only deals with the refactoring of how 'commit_messages_str' is used across different tools.
  • 🔒 Security concerns: No, the changes made in this PR do not introduce any potential security issues.

PR Feedback

  • 💡 General PR suggestions: The PR is well-structured and the changes are consistent across all the files. However, it would be beneficial to include a description of the PR to provide more context about the changes. Additionally, it would be good to include tests to ensure that the changes do not break any existing functionality.

How to use

To invoke the PR-Agent, add a comment using one of the following commands:
/review [-i]: Request a review of your Pull Request. For an incremental review, which only considers changes since the last review, include the '-i' option.
/describe: Modify the PR title and description based on the contents of the PR.
/improve: Suggest improvements to the code in the PR.
/ask <QUESTION>: Pose a question about the PR.

To edit any configuration parameter from 'configuration.toml', add --config_path=new_value
For example: /review --pr_reviewer.extra_instructions="focus on the file: ..."

@mrT23 mrT23 changed the title commit_messages_str is used in all tools Use commit messages in PR tools Aug 2, 2023
@mrT23 mrT23 added the enhancement New feature or request label Aug 2, 2023
@mrT23
Copy link
Collaborator Author

mrT23 commented Aug 2, 2023

Changelog updates:

2023-08-02

Enhanced

  • Updated several tools in the pr_agent package to utilize commit messages in their functionality.
  • Commit messages are now retrieved and stored in the vars dictionary for each tool.
  • Added sections to display commit messages in various settings files.

to commit the new content to the CHANGELOG.md file, please type:
'/update_changelog --pr_update_changelog.push_changelog_changes=true'

@mrT23
Copy link
Collaborator Author

mrT23 commented Aug 2, 2023

/update_changelog --pr_update_changelog.push_changelog_changes=true

Comment on lines +1 to +6
## 2023-08-02

### Enhanced
- Updated several tools in the `pr_agent` package to use commit messages in their functionality.
- Commit messages are now retrieved and stored in the `vars` dictionary for each tool.
- Added a section to display the commit messages in the prompts of various tools.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CHANGELOG.md update

@mrT23 mrT23 merged commit cfa1417 into main Aug 3, 2023
@mrT23 mrT23 deleted the tr/further_use_commit_messages branch August 3, 2023 04:58
@hussam789
Copy link
Collaborator

/improve

pr_agent/tools/pr_code_suggestions.py Show resolved Hide resolved
pr_agent/tools/pr_description.py Show resolved Hide resolved
pr_agent/tools/pr_information_from_user.py Show resolved Hide resolved
pr_agent/tools/pr_questions.py Show resolved Hide resolved
@mrT23
Copy link
Collaborator Author

mrT23 commented Aug 5, 2023

PR Analysis

  • 🎯 Main theme: Enhancement of PR tools by incorporating commit messages
  • 📌 Type of PR: Enhancement
  • 🧪 Relevant tests added: No
  • Focused PR: Yes, the PR is focused as it has a clear and coherent title and description. All the changes in the PR are logically derived from the title and description, which is about enhancing PR tools by incorporating commit messages.
  • 🔒 Security concerns: No, the PR does not introduce any apparent security concerns. The changes are mainly about retrieving and storing commit messages, which does not involve any sensitive data or operations that could lead to security issues.

PR Feedback

  • General suggestions: The PR is well-structured and the changes are logically consistent with the PR's purpose. However, it would be beneficial to include tests to verify the new functionality. Additionally, consider handling potential exceptions that may occur when retrieving commit messages.

  • 🤖 Code feedback:

    • relevant file: pr_agent/tools/pr_code_suggestions.py
      suggestion content: Consider handling potential exceptions that may occur when retrieving commit messages. This can be done by wrapping the self.git_provider.get_commit_messages() call in a try-except block and providing an appropriate error message if an exception is thrown. [important]
      relevant line in file: "commit_messages_str": self.git_provider.get_commit_messages(),

    • relevant file: pr_agent/tools/pr_description.py
      suggestion content: It's a good practice to keep the initialization of variables close to their usage. In this case, the commit_messages_str variable was removed and its value was directly assigned in the vars dictionary. This is a good practice as it improves code readability and maintainability. [medium]
      relevant line in file: "commit_messages_str": self.git_provider.get_commit_messages()

    • relevant file: pr_agent/tools/pr_information_from_user.py
      suggestion content: Consider adding a comment explaining the purpose of the commit_messages_str key in the vars dictionary. This will improve code readability and maintainability. [medium]
      relevant line in file: "commit_messages_str": self.git_provider.get_commit_messages(),

yochail pushed a commit to yochail/pr-agent that referenced this pull request Feb 11, 2024
…_messages

Use commit messages in PR tools
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants