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

feat: Enable PR description publishing as comment in bitbucket_app.py #521

Merged
merged 3 commits into from
Dec 12, 2023

Conversation

mrT23
Copy link
Collaborator

@mrT23 mrT23 commented Dec 12, 2023

No description provided.

Copy link
Contributor

PR Analysis

  • 🎯 Main theme: Enabling PR description publishing as comment in bitbucket_app.py
  • 📝 PR summary: This PR introduces a new setting that allows the publishing of PR descriptions as comments in the Bitbucket application. This is achieved by adding a new setting in the start() function of bitbucket_app.py.
  • 📌 Type of PR: Enhancement
  • 🧪 Relevant tests added: No
  • ⏱️ Estimated effort to review [1-5]: 1, because the PR is small and straightforward, only adding a single line of code.
  • 🔒 Security concerns: No security concerns found

PR Feedback

  • 💡 General suggestions: It would be beneficial to add tests that verify the new functionality. This would ensure that the new setting works as expected and does not introduce any regressions.

  • 🤖 Code feedback:
    relevant filepr_agent/servers/bitbucket_app.py
    suggestion      Consider making the setting configurable through environment variables or a configuration file. This would allow for easier customization without needing to modify the source code. [important]
    relevant lineget_settings().set("PR_DESCRIPTION.PUBLISH_DESCRIPTION_AS_COMMENT", True)

How to use

Instructions

To invoke the PR-Agent, add a comment using one of the following commands:
/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 for more details.

To edit any configuration parameter from the 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.

Copy link
Contributor

PR Code Suggestions

💡 Suggestion:

Consider grouping the settings configuration into a separate function for better readability and maintainability.

File: pr_agent/servers/bitbucket_app.py (154-157)

Example code:

Existing code:

def start():
    get_settings().set("CONFIG.PUBLISH_OUTPUT_PROGRESS", False)
    get_settings().set("CONFIG.GIT_PROVIDER", "bitbucket")
    get_settings().set("PR_DESCRIPTION.PUBLISH_DESCRIPTION_AS_COMMENT", True)
    middleware = [Middleware(RawContextMiddleware)]
    app = FastAPI(middleware=middleware)
    app.include_router(router)

Improved code:

def start():
    configure_settings()
    middleware = [Middleware(RawContextMiddleware)]
    app = FastAPI(middleware=middleware)
    app.include_router(router)

def configure_settings():
    get_settings().set("CONFIG.PUBLISH_OUTPUT_PROGRESS", False)
    get_settings().set("CONFIG.GIT_PROVIDER", "bitbucket")
    get_settings().set("PR_DESCRIPTION.PUBLISH_DESCRIPTION_AS_COMMENT", True)

@mrT23 mrT23 merged commit 648dd32 into main Dec 12, 2023
4 checks passed
@mrT23 mrT23 deleted the tr/bitbucket_app branch December 12, 2023 08:27
yochail pushed a commit to yochail/pr-agent that referenced this pull request Feb 11, 2024
feat: Enable PR description publishing as comment in bitbucket_app.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants