diff --git a/pr_agent/algo/utils.py b/pr_agent/algo/utils.py index 5a1e332db..4c87c0382 100644 --- a/pr_agent/algo/utils.py +++ b/pr_agent/algo/utils.py @@ -575,7 +575,7 @@ def clip_tokens(text: str, max_tokens: int, add_three_dots=True) -> str: num_output_chars = int(chars_per_token * max_tokens) clipped_text = text[:num_output_chars] if add_three_dots: - clipped_text += " ...(truncated)" + clipped_text += "\n...(truncated)" return clipped_text except Exception as e: get_logger().warning(f"Failed to clip tokens: {e}") diff --git a/pr_agent/git_providers/github_provider.py b/pr_agent/git_providers/github_provider.py index de54ec3f9..574e28cff 100644 --- a/pr_agent/git_providers/github_provider.py +++ b/pr_agent/git_providers/github_provider.py @@ -745,22 +745,4 @@ def auto_approve(self) -> bool: return False def calc_pr_statistics(self, pull_request_data: dict): - try: - out = {} - from datetime import datetime - created_at = pull_request_data['created_at'] - closed_at = pull_request_data['closed_at'] - closed_at_datetime = datetime.strptime(closed_at, "%Y-%m-%dT%H:%M:%SZ") - created_at_datetime = datetime.strptime(created_at, "%Y-%m-%dT%H:%M:%SZ") - difference = closed_at_datetime - created_at_datetime - out['hours'] = difference.total_seconds() / 3600 - out['commits'] = pull_request_data['commits'] - out['comments'] = pull_request_data['comments'] - out['review_comments'] = pull_request_data['review_comments'] - out['changed_files'] = pull_request_data['changed_files'] - out['additions'] = pull_request_data['additions'] - out['deletions'] = pull_request_data['deletions'] - except Exception as e: - get_logger().exception(f"Failed to calculate PR statistics, error: {e}") - return {} - return out + return {} diff --git a/pr_agent/tools/pr_reviewer.py b/pr_agent/tools/pr_reviewer.py index 4d1739a54..c257c30a3 100644 --- a/pr_agent/tools/pr_reviewer.py +++ b/pr_agent/tools/pr_reviewer.py @@ -357,6 +357,9 @@ def _can_run_incremental_review(self) -> bool: return True def set_review_labels(self, data): + if not get_settings().config.publish_output: + return + if (get_settings().pr_reviewer.enable_review_labels_security or get_settings().pr_reviewer.enable_review_labels_effort): try: diff --git a/tests/unittest/test_clip_tokens.py b/tests/unittest/test_clip_tokens.py index 2405a06b7..a56ff92f6 100644 --- a/tests/unittest/test_clip_tokens.py +++ b/tests/unittest/test_clip_tokens.py @@ -15,5 +15,5 @@ def test_clip(self): max_tokens = 10 result = clip_tokens(text, max_tokens) - expected_results = 'line1\nline2\nline3\nli ...(truncated)' + expected_results = 'line1\nline2\nline3\nli\n...(truncated)' assert result == expected_results