Skip to content

Commit f2adea2

Browse files
committed
EX-322: debug v7
1 parent 35f4c57 commit f2adea2

2 files changed

Lines changed: 19 additions & 20 deletions

File tree

src/code_review_agent/bitbucket_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,11 @@ def cleanup_and_post_all_comments(all_issues: list[CodeIssue], files_with_issues
120120

121121
else:
122122
logger.info(f" - Found {len(all_issues)} issue(s). Posting comments.")
123-
123+
124124
requests.delete(approve_url, auth=auth)
125-
logger.info(" - Ensured PR is not approved by this agent (removed approval if existed).")
125+
logger.info(" - Ensured PR is not approved by this agent (removed approval if existed).")
126126

127-
_publish_without_cleanup(all_issues, files_with_issues, base_url, auth, headers)
127+
_publish_without_cleanup(all_issues, files_with_issues, base_url, auth, headers)
128128

129129
except (ValueError, requests.exceptions.RequestException) as e:
130130
logger.error(f"❌ An error occurred during the publishing process: {e}", exc_info=True)

src/code_review_agent/cli.py

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -213,24 +213,23 @@ def review(
213213

214214
is_github_pr = "GITHUB_ACTIONS" in os.environ and "GITHUB_PR_NUMBER" in os.environ
215215
is_bitbucket_pr = "BITBUCKET_PR_ID" in os.environ
216-
if all_issues:
217-
if is_github_pr:
218-
logging.info("🚀 Publishing results to GitHub PR...")
219-
for file_path, issues in files_with_issues.items():
220-
for issue in issues:
221-
github_client.post_pr_comment(issue, file_path)
216+
217+
if is_github_pr:
218+
logging.info("🚀 Publishing results to GitHub PR...")
219+
github_client.handle_pr_results(all_issues, files_with_issues)
220+
221+
elif is_bitbucket_pr:
222+
logging.info("🚀 Publishing results to Bitbucket PR...")
223+
bitbucket_client.cleanup_and_post_all_comments(all_issues, files_with_issues)
222224

223-
elif is_bitbucket_pr:
224-
bitbucket_client.cleanup_and_post_all_comments(all_issues, files_with_issues)
225-
226-
else:
227-
for file_path, issues in files_with_issues.items():
228-
logging.info(f"\n🚨 Issues in `{file_path}`:")
229-
for issue in issues:
230-
logging.info(f" - L{issue.line_number} [{issue.issue_type}]: {issue.comment}")
231-
if issue.suggestion:
232-
logging.info(f" 💡 Suggestion: {issue.suggestion}")
233-
logging.info(f" ```\n {issue.suggestion}\n ```")
225+
elif all_issues:
226+
for file_path, issues in files_with_issues.items():
227+
logging.info(f"\n🚨 Issues in `{file_path}`:")
228+
for issue in issues:
229+
logging.info(f" - L{issue.line_number} [{issue.issue_type}]: {issue.comment}")
230+
if issue.suggestion:
231+
logging.info(f" 💡 Suggestion: {issue.suggestion}")
232+
logging.info(f" ```\n {issue.suggestion}\n ```")
234233

235234

236235
if not all_issues:

0 commit comments

Comments
 (0)