mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-03 12:20:38 +08:00
feat: Enhance inline comment publishing in Bitbucket provider and add logging for no suggestions in pr_code_suggestions.py
This commit is contained in:
@ -254,7 +254,15 @@ class BitbucketProvider(GitProvider):
|
|||||||
|
|
||||||
def publish_inline_comments(self, comments: list[dict]):
|
def publish_inline_comments(self, comments: list[dict]):
|
||||||
for comment in comments:
|
for comment in comments:
|
||||||
|
if 'position' in comment:
|
||||||
self.publish_inline_comment(comment['body'], comment['position'], comment['path'])
|
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):
|
def get_title(self):
|
||||||
return self.pr.title
|
return self.pr.title
|
||||||
|
@ -119,6 +119,7 @@ class PRCodeSuggestions:
|
|||||||
code_suggestions = []
|
code_suggestions = []
|
||||||
|
|
||||||
if not 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.')
|
return self.git_provider.publish_comment('No suggestions found to improve this PR.')
|
||||||
|
|
||||||
for d in data['Code suggestions']:
|
for d in data['Code suggestions']:
|
||||||
|
Reference in New Issue
Block a user