Extract JIRA and GitHub issue references.
(entry_text: str)
| 282 | |
| 283 | @staticmethod |
| 284 | def extract_issues(entry_text: str) -> List[Link]: |
| 285 | """Extract JIRA and GitHub issue references.""" |
| 286 | links = [] |
| 287 | seen_issues = set() # Track seen issues to avoid duplicates |
| 288 | |
| 289 | # Extract SOLR, LUCENE, INFRA issues |
| 290 | for match in IssueExtractor.JIRA_ISSUE_PATTERN.finditer(entry_text): |
| 291 | issue_id = match.group(0) # Full "SOLR-12345" or "LUCENE-12345" format |
| 292 | if issue_id not in seen_issues: |
| 293 | url = f"https://issues.apache.org/jira/browse/{issue_id}" |
| 294 | links.append(Link(name=issue_id, url=url)) |
| 295 | seen_issues.add(issue_id) |
| 296 | |
| 297 | # Extract GitHub PRs in multiple formats: |
| 298 | # "PR#3758", "PR-2475", "GITHUB#3666" |
| 299 | github_patterns = [ |
| 300 | (r'PR[#-](\d+)', 'PR#'), # PR#1234 or PR-1234 |
| 301 | (r'GITHUB#(\d+)', 'GITHUB#'), # GITHUB#3666 |
| 302 | ] |
| 303 | |
| 304 | for pattern_str, prefix in github_patterns: |
| 305 | pattern = re.compile(pattern_str) |
| 306 | for match in pattern.finditer(entry_text): |
| 307 | pr_num = match.group(1) |
| 308 | pr_name = f"{prefix}{pr_num}" |
| 309 | if pr_name not in seen_issues: |
| 310 | url = f"https://github.com/apache/solr/pull/{pr_num}" |
| 311 | links.append(Link(name=pr_name, url=url)) |
| 312 | seen_issues.add(pr_name) |
| 313 | |
| 314 | return links |
| 315 | |
| 316 | |
| 317 | class SlugGenerator: |
no test coverage detected