MCPcopy Create free account
hub / github.com/apache/solr / extract_jira_issues_from_title

Function extract_jira_issues_from_title

dev-tools/scripts/scriptutil.py:247–266  ·  view source on GitHub ↗

Return (cleaned_title, links) where links list unique JIRA issues found in title.

(title)

Source from the content-addressed store, hash-verified

245
246
247def extract_jira_issues_from_title(title):
248 """Return (cleaned_title, links) where links list unique JIRA issues found in title."""
249 jira = re.compile(r'(?:SOLR|LUCENE|INFRA)-\d+')
250
251 seen = set()
252 links = [
253 {'name': m, 'url': f'https://issues.apache.org/jira/browse/{m}'}
254 for m in jira.findall(title)
255 if not (m in seen or seen.add(m))
256 ]
257
258 cleaned = title
259 # Remove variants at start or when slash-separated, then normalize whitespace
260 cleaned = re.sub(r'^\s*/\s*' + jira.pattern + r'[\s:]*', '', cleaned)
261 cleaned = re.sub(r'\s+/\s*' + jira.pattern + r'[\s:]*', ' ', cleaned)
262 cleaned = re.sub(r'^' + jira.pattern + r'[\s:]*', '', cleaned)
263 cleaned = re.sub(r'^\s*/\s*', '', cleaned).strip()
264 cleaned = re.sub(r'\s+', ' ', cleaned)
265
266 return cleaned, links
267
268
269if __name__ == '__main__':

Callers 1

to_yaml_dictMethod · 0.85

Calls 4

stripMethod · 0.80
addMethod · 0.65
setFunction · 0.50
subMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…