From a42c5f4f93b53e6bfb5a0abf9bdc90755ffd4ae7 Mon Sep 17 00:00:00 2001 From: "Hussam.lawen" Date: Sun, 26 Jan 2025 14:31:29 +0200 Subject: [PATCH] feat: limit number of tickets to analyze to 3 in compliance check --- pr_agent/tools/ticket_pr_compliance_check.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pr_agent/tools/ticket_pr_compliance_check.py b/pr_agent/tools/ticket_pr_compliance_check.py index 05cd64fe..54c72eb9 100644 --- a/pr_agent/tools/ticket_pr_compliance_check.py +++ b/pr_agent/tools/ticket_pr_compliance_check.py @@ -51,6 +51,11 @@ def extract_ticket_links_from_pr_description(pr_description, repo_path, base_url issue_number = match[5][1:] # remove # if issue_number.isdigit() and len(issue_number) < 5 and repo_path: github_tickets.add(f'{base_url_html.strip("/")}/{repo_path}/issues/{issue_number}') + + if len(github_tickets) > 3: + get_logger().info(f"Too many tickets found in PR description: {len(github_tickets)}") + # Limit the number of tickets to 3 + github_tickets = set(list(github_tickets)[:3]) except Exception as e: get_logger().error(f"Error extracting tickets error= {e}", artifact={"traceback": traceback.format_exc()})