Skip to content

Commit

Permalink
Merge pull request Codium-ai#485 from Codium-ai/tr/bitbucket
Browse files Browse the repository at this point in the history
Enhancement of Inline Comment Publishing in Bitbucket Provider and Logging Addition
  • Loading branch information
mrT23 authored Nov 28, 2023
2 parents e95f735 + 4f01f21 commit b69aaa3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pr_agent/git_providers/bitbucket_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,15 @@ def generate_link_to_relevant_line_number(self, suggestion) -> str:

def publish_inline_comments(self, comments: list[dict]):
for comment in comments:
self.publish_inline_comment(comment['body'], comment['position'], comment['path'])
if 'position' in comment:
self.publish_inline_comment(comment['body'], comment['position'], comment['path'])
elif 'start_line' in comment: # multi-line comment
# note that bitbucket does not seem to support range - only a comment on a single line - https://community.developer.atlassian.com/t/api-post-endpoint-for-inline-pull-request-comments/60452
self.publish_inline_comment(comment['body'], comment['start_line'], comment['path'])
elif 'line' in comment: # single-line comment
self.publish_inline_comment(comment['body'], comment['line'], comment['path'])
else:
get_logger().error(f"Could not publish inline comment {comment}")

def get_title(self):
return self.pr.title
Expand Down
1 change: 1 addition & 0 deletions pr_agent/tools/pr_code_suggestions.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def push_inline_code_suggestions(self, data):
code_suggestions = []

if not data['Code suggestions']:
get_logger().info('No suggestions found to improve this PR.')
return self.git_provider.publish_comment('No suggestions found to improve this PR.')

for d in data['Code suggestions']:
Expand Down

0 comments on commit b69aaa3

Please sign in to comment.