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

disable publishing labels by default #1299

Merged
merged 2 commits into from
Oct 22, 2024
Merged

Conversation

mrT23
Copy link
Collaborator

@mrT23 mrT23 commented Oct 21, 2024

User description

…elated documentation


PR Type

documentation, enhancement


Description

  • Updated the default setting for pr_description.publish_labels to false across the codebase and documentation.
  • Added a check for pr_labels in the label publishing logic to prevent unnecessary operations.
  • Enhanced documentation to provide users with guidance on how to adjust the publish_labels setting according to their preferences.

Changes walkthrough 📝

Relevant files
Enhancement
pr_description.py
Add check for `pr_labels` before publishing                           

pr_agent/tools/pr_description.py

  • Added a check for pr_labels before publishing labels.
+1/-1     
Documentation
README.md
Update README with new default label settings                       

README.md

  • Updated default setting for publish_labels to false.
  • Explained rationale behind the change.
  • Provided instructions for overriding the default setting.
  • +10/-0   
    describe.md
    Update `publish_labels` default in documentation                 

    docs/docs/tools/describe.md

    • Changed documentation to reflect new default for publish_labels.
    +2/-2     
    Configuration changes
    configuration.toml
    Set `publish_labels` default to false in config                   

    pr_agent/settings/configuration.toml

    • Changed default setting for publish_labels to false.
    +1/-1     

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    @mrT23 mrT23 requested a review from hussam789 October 21, 2024 14:56
    @qodo-merge-pro qodo-merge-pro bot added documentation Improvements or additions to documentation enhancement New feature or request Review effort [1-5]: 2 labels Oct 21, 2024
    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🏅 Score: 95
    🧪 No relevant tests
    🔒 No security concerns identified
    🔀 Multiple PR themes

    Sub-PR theme: Update documentation for publish_labels default change

    Relevant files:

    • README.md
    • docs/docs/tools/describe.md

    Sub-PR theme: Implement publish_labels default change in code

    Relevant files:

    • pr_agent/tools/pr_description.py
    • pr_agent/settings/configuration.toml

    ⚡ Recommended focus areas for review

    Logic Change
    The condition for publishing labels has been modified. Verify if this change aligns with the intended behavior and doesn't introduce any unintended side effects.

    Copy link
    Contributor

    qodo-merge-pro bot commented Oct 21, 2024

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Enhancement
    Add error handling for cases when labels cannot be published

    Consider adding a log message or raising an exception when pr_labels is empty or
    None, to help with debugging and to ensure the expected behavior is clear.

    pr_agent/tools/pr_description.py [136-138]

    -if get_settings().pr_description.publish_labels and pr_labels and self.git_provider.is_supported("get_labels"):
    -    original_labels = self.git_provider.get_pr_labels(update=True)
    -    get_logger().debug(f"original labels", artifact=original_labels)
    +if get_settings().pr_description.publish_labels:
    +    if pr_labels and self.git_provider.is_supported("get_labels"):
    +        original_labels = self.git_provider.get_pr_labels(update=True)
    +        get_logger().debug(f"original labels", artifact=original_labels)
    +    else:
    +        get_logger().warning("Unable to publish labels: pr_labels is empty or get_labels is not supported")
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    Why: The suggestion to add error handling when pr_labels is empty or unsupported is valuable for debugging and ensuring clarity of expected behavior. It enhances the robustness of the code by providing feedback when label publication fails.

    7
    Improve documentation by providing a more specific link to configuration options

    Consider adding a link to the configuration file documentation for easier access to
    information on how to override the default setting.

    README.md [52]

    -However, every user has different preferences. To still publish the `describe` labels, set `pr_description.publish_labels=true` in the [configuration file](https://qodo-merge-docs.qodo.ai/usage-guide/configuration_options/).
    +However, every user has different preferences. To still publish the `describe` labels, set `pr_description.publish_labels=true` in the [configuration file](https://qodo-merge-docs.qodo.ai/usage-guide/configuration_options/#pr_description).
    • Apply this suggestion
    Suggestion importance[1-10]: 5

    Why: The suggestion to provide a more specific link in the documentation improves user experience by making it easier to find relevant information. While helpful, it is a minor enhancement to the documentation.

    5
    • Author self-review: I have reviewed the PR code suggestions, and addressed the relevant ones.

    💡 Need additional feedback ? start a PR chat

    @mrT23
    Copy link
    Collaborator Author

    mrT23 commented Oct 21, 2024

    /improve
    --pr_code_suggestions.commitable_code_suggestions=true

    @@ -133,7 +133,7 @@ async def run(self):

    if get_settings().config.publish_output:
    # publish labels
    if get_settings().pr_description.publish_labels and self.git_provider.is_supported("get_labels"):
    if get_settings().pr_description.publish_labels and pr_labels and self.git_provider.is_supported("get_labels"):
    original_labels = self.git_provider.get_pr_labels(update=True)
    get_logger().debug(f"original labels", artifact=original_labels)
    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    Suggestion: Consider using an f-string for the debug log message to improve readability and consistency. [enhancement, importance: 7]

    Suggested change
    get_logger().debug(f"original labels", artifact=original_labels)
    get_logger().debug(f"original labels: {original_labels}")

    @@ -133,7 +133,7 @@ async def run(self):

    if get_settings().config.publish_output:
    # publish labels
    if get_settings().pr_description.publish_labels and self.git_provider.is_supported("get_labels"):
    if get_settings().pr_description.publish_labels and pr_labels and self.git_provider.is_supported("get_labels"):
    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    Suggestion: Consider adding a check for pr_labels before the conditional statement to avoid potential issues if pr_labels is None or empty. [possible issue, importance: 5]

    @mrT23 mrT23 changed the title docs: update default setting for publish_labels to false and adjust r… docs: update default setting for publish_labels to false Oct 22, 2024
    @mrT23 mrT23 removed documentation Improvements or additions to documentation enhancement New feature or request labels Oct 22, 2024
    @mrT23 mrT23 changed the title docs: update default setting for publish_labels to false disable publishing labels by default Oct 22, 2024
    @mrT23 mrT23 added documentation Improvements or additions to documentation enhancement New feature or request labels Oct 22, 2024
    @mrT23 mrT23 merged commit c70acdc into main Oct 22, 2024
    2 checks passed
    @mrT23 mrT23 deleted the tr/disable_default_publish_labels branch October 22, 2024 05:13
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    documentation Improvements or additions to documentation enhancement New feature or request Review effort [1-5]: 2
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants