mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-05 05:10:38 +08:00
simpler solution
This commit is contained in:
@ -196,10 +196,6 @@ class GitLabProvider(GitProvider):
|
|||||||
return self.last_diff # fallback to last_diff if no relevant diff is found
|
return self.last_diff # fallback to last_diff if no relevant diff is found
|
||||||
|
|
||||||
def publish_code_suggestions(self, code_suggestions: list) -> bool:
|
def publish_code_suggestions(self, code_suggestions: list) -> bool:
|
||||||
if len(code_suggestions) > 1:
|
|
||||||
logging.debug(f"in gitlab we dont currently support publishing multiple code suggestions simultaneously")
|
|
||||||
return False
|
|
||||||
|
|
||||||
for suggestion in code_suggestions:
|
for suggestion in code_suggestions:
|
||||||
try:
|
try:
|
||||||
body = suggestion['body']
|
body = suggestion['body']
|
||||||
@ -231,6 +227,7 @@ class GitLabProvider(GitProvider):
|
|||||||
target_file, target_line_no)
|
target_file, target_line_no)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.exception(f"Could not publish code suggestion:\nsuggestion: {suggestion}\nerror: {e}")
|
logging.exception(f"Could not publish code suggestion:\nsuggestion: {suggestion}\nerror: {e}")
|
||||||
|
return True
|
||||||
|
|
||||||
def search_line(self, relevant_file, relevant_line_in_file):
|
def search_line(self, relevant_file, relevant_line_in_file):
|
||||||
target_file = None
|
target_file = None
|
||||||
|
@ -140,7 +140,7 @@ class PRCodeSuggestions:
|
|||||||
|
|
||||||
is_successful = self.git_provider.publish_code_suggestions(code_suggestions)
|
is_successful = self.git_provider.publish_code_suggestions(code_suggestions)
|
||||||
if not is_successful:
|
if not is_successful:
|
||||||
# logging.info("Failed to publish code suggestions, trying to publish each suggestion separately")
|
logging.info("Failed to publish code suggestions, trying to publish each suggestion separately")
|
||||||
for code_suggestion in code_suggestions:
|
for code_suggestion in code_suggestions:
|
||||||
self.git_provider.publish_code_suggestions([code_suggestion])
|
self.git_provider.publish_code_suggestions([code_suggestion])
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user