You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub-PR theme: Implement avoid_full_files option for Bitbucket provider
Relevant files:
pr_agent/git_providers/bitbucket_provider.py
pr_agent/settings/configuration.toml
Sub-PR theme: Update documentation for Bitbucket rate limits and new configuration option
Relevant files:
docs/docs/usage-guide/automations_and_usage.md
⚡ Key issues to review
Code Duplication The condition for counter_valid < MAX_FILES_ALLOWED_FULL // 2 is still present in the code, which might lead to confusion or unexpected behavior when avoid_full_files is set to true.
-Note that among other limitations, BitBucket provides relatively low rate-limits for applications (up to 1000 requests per hour), and does not provide an API to track the actual rate-limit usage.+Note that among other limitations, BitBucket provides relatively low rate-limits for applications (up to 1000 requests per hour), and does not provide an API to track the actual rate-limit usage. For more information, see [BitBucket's rate limiting documentation](https://developer.atlassian.com/cloud/bitbucket/rest/intro/#rate-limiting).
Apply this suggestion
Suggestion importance[1-10]: 8
Why: Adding a link to BitBucket's rate limiting documentation provides valuable additional information for users and improves the overall quality of the documentation.
8
Add a comment explaining the purpose of setting empty strings
Consider adding a comment explaining why we're setting empty strings for original_file_content_str and new_file_content_str when avoiding full files.
if get_settings().get("bitbucket_app.avoid_full_files", False):
+ # Set empty strings to avoid fetching full file content, reducing API calls
original_file_content_str = ""
new_file_content_str = ""
Apply this suggestion
Suggestion importance[1-10]: 6
Why: Adding a comment to explain the purpose of setting empty strings enhances code readability and helps other developers understand the rationale behind this decision.
6
Maintainability
Use a constant for configuration key to improve maintainability
Consider using a constant for the configuration key "bitbucket_app.avoid_full_files" to improve maintainability and reduce the risk of typos.
Why: Using a constant for the configuration key improves code maintainability and reduces the risk of typos, which is a good practice for frequently used string literals.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Type
Enhancement
Description
bitbucket_app.avoid_full_files
configuration option to reduce API calls to Bitbucketget_diff_files
method inbitbucket_provider.py
to respect the new settingavoid_full_files
tofalse
inconfiguration.toml
Changes walkthrough 📝
bitbucket_provider.py
Implement option to avoid fetching full file content
pr_agent/git_providers/bitbucket_provider.py
bitbucket_app.avoid_full_files
setting
automations_and_usage.md
Document Bitbucket rate limits and new configuration option
docs/docs/usage-guide/automations_and_usage.md
bitbucket_app.avoid_full_files=true
configurationoption
configuration.toml
Add new configuration option for avoiding full file fetches
pr_agent/settings/configuration.toml
avoid_full_files = false
setting under the[bitbucket_app]
section