-
Notifications
You must be signed in to change notification settings - Fork 529
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
Fix bitbucket improve issue #240
Changes from 7 commits
67ff505
db6bf41
f0dc485
0e42634
39522ab
2aaa722
970a789
704c169
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -73,14 +73,18 @@ async def run(self): | |||||||||
if get_settings().config.publish_output: | ||||||||||
logging.info('Pushing answer...') | ||||||||||
if get_settings().pr_description.publish_description_as_comment: | ||||||||||
self.git_provider.publish_comment(markdown_text) | ||||||||||
self.git_provider.publish_comment(pr_body) | ||||||||||
else: | ||||||||||
self.git_provider.publish_description(pr_title, pr_body) | ||||||||||
if self.git_provider.is_supported("get_labels"): | ||||||||||
current_labels = self.git_provider.get_labels() | ||||||||||
if current_labels is None: | ||||||||||
current_labels = [] | ||||||||||
self.git_provider.publish_labels(pr_types + current_labels) | ||||||||||
# bitbucket does not support publishing PR labels yet | ||||||||||
if get_settings().config.git_provider == 'bitbucket': | ||||||||||
return | ||||||||||
Comment on lines
+79
to
+80
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Consider removing the redundant
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't refer explicitly to a Git provider outside the git providers types (use "is_supported") |
||||||||||
else: | ||||||||||
self.git_provider.publish_description(pr_title, pr_body) | ||||||||||
if self.git_provider.is_supported("get_labels"): | ||||||||||
current_labels = self.git_provider.get_labels() | ||||||||||
if current_labels is None: | ||||||||||
current_labels = [] | ||||||||||
self.git_provider.publish_labels(pr_types + current_labels) | ||||||||||
self.git_provider.remove_initial_comment() | ||||||||||
|
||||||||||
return "" | ||||||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -266,7 +266,10 @@ def _publish_inline_code_comments(self) -> None: | |||||||||||
self.git_provider.publish_inline_comment(content, relevant_file, relevant_line_in_file) | ||||||||||||
|
||||||||||||
if comments: | ||||||||||||
self.git_provider.publish_inline_comments(comments) | ||||||||||||
if get_settings().config.git_provider == 'bitbucket': | ||||||||||||
self.git_provider.publish_bitbucket_inline_comments(comments) | ||||||||||||
else: | ||||||||||||
self.git_provider.publish_inline_comments(comments) | ||||||||||||
Comment on lines
+269
to
+272
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Consider refactoring the code to avoid duplicating the
Suggested change
|
||||||||||||
|
||||||||||||
def _get_user_answers(self) -> Tuple[str, str]: | ||||||||||||
""" | ||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -46,7 +46,7 @@ def __init__(self, pr_url: str, cli_mode=False, args=None): | |||||||
get_settings().pr_update_changelog_prompt.user) | ||||||||
|
||||||||
async def run(self): | ||||||||
assert type(self.git_provider) == GithubProvider, "Currently only Github is supported" | ||||||||
# assert type(self.git_provider) == GithubProvider, "Currently only Github is supported" | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Consider replacing the assertion with a more user-friendly error handling mechanism. Assertions can be turned off globally in the Python interpreter, and they are typically used for debugging, not for handling run-time errors.
Suggested change
|
||||||||
|
||||||||
logging.info('Updating the changelog...') | ||||||||
if get_settings().config.publish_output: | ||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Consider using the
requests.post
method instead ofrequests.request
with 'POST' as a parameter. This would make the code more readable and easier to understand.