@@ -283,33 +283,41 @@ def resolve_jira_issues(title, merge_branches, comment):
283283
284284def standardize_jira_ref (text ):
285285 """
286- Standardize the [MODULE] SPARK-XXXXX prefix
287- Converts "[SPARK-XXX][mllib] Issue", "[MLLib] SPARK-XXX. Issue" or "SPARK XXX [MLLIB]: Issue" to "[MLLIB] SPARK-XXX: Issue"
286+ Standardize the [SPARK-XXXXX] [MODULE] prefix
287+ Converts "[SPARK-XXX][mllib] Issue", "[MLLib] SPARK-XXX. Issue" or "SPARK XXX [MLLIB]: Issue" to "[SPARK-XXX] [MLLIB] Issue"
288288
289289 >>> standardize_jira_ref("[SPARK-5821] [SQL] ParquetRelation2 CTAS should check if delete is successful")
290- '[SQL] SPARK-5821: ParquetRelation2 CTAS should check if delete is successful'
290+ '[SPARK-5821] [SQL] ParquetRelation2 CTAS should check if delete is successful'
291291 >>> standardize_jira_ref("[SPARK-4123][Project Infra][WIP]: Show new dependencies added in pull requests")
292- '[PROJECT INFRA] [WIP] SPARK-4123: Show new dependencies added in pull requests'
292+ '[SPARK-4123] [ PROJECT INFRA] [WIP] Show new dependencies added in pull requests'
293293 >>> standardize_jira_ref("[MLlib] Spark 5954: Top by key")
294- '[MLLIB] SPARK-5954: Top by key'
294+ '[SPARK-5954] [MLLIB] Top by key'
295+ >>> standardize_jira_ref("[SPARK-979] a LRU scheduler for load balancing in TaskSchedulerImpl")
296+ '[SPARK-979] a LRU scheduler for load balancing in TaskSchedulerImpl'
297+ >>> standardize_jira_ref("SPARK-1094 Support MiMa for reporting binary compatibility accross versions.")
298+ '[SPARK-1094] Support MiMa for reporting binary compatibility accross versions.'
299+ >>> standardize_jira_ref("[WIP] [SPARK-1146] Vagrant support for Spark")
300+ '[SPARK-1146] [WIP] Vagrant support for Spark'
301+ >>> standardize_jira_ref("SPARK-1032. If Yarn app fails before registering, app master stays aroun...")
302+ '[SPARK-1032] If Yarn app fails before registering, app master stays aroun...'
295303 """
296- #If the string is compliant, no need to process any further
297- if (re .search (r'\[[A-Z0-9_]+\] SPARK-[0-9]{3,5}: \S+' , text )):
304+ # If the string is compliant, no need to process any further
305+ if (re .search (r'^\[ SPARK-[0-9]{3,6}\] (\[[A-Z0-9_\s,]+\] )+ \S+' , text )):
298306 return text
299307
300308 # Extract JIRA ref(s):
301309 jira_refs = deque ()
302- pattern = re .compile (r'(SPARK[-\s]*[0-9]{3,5 })' , re .IGNORECASE )
310+ pattern = re .compile (r'(SPARK[-\s]*[0-9]{3,6 })' , re .IGNORECASE )
303311 while (pattern .search (text ) is not None ):
304312 ref = pattern .search (text ).groups ()[0 ]
305313 # Replace any whitespace with a dash & convert to uppercase
306- jira_refs .append (re .sub (r'\s+' , '-' , ref .upper ()))
314+ jira_refs .append ('[' + re .sub (r'\s+' , '-' , ref .upper ()) + ']' )
307315 text = text .replace (ref , '' )
308316
309317 # Extract spark component(s):
310318 components = deque ()
311- # Look for alphanumeric chars, spaces, and/or commas
312- pattern = re .compile (r'(\[[\w\s,]+\])' , re .IGNORECASE )
319+ # Look for alphanumeric chars, spaces, dashes, periods, and/or commas
320+ pattern = re .compile (r'(\[[\w\s,-\. ]+\])' , re .IGNORECASE )
313321 while (pattern .search (text ) is not None ):
314322 component = pattern .search (text ).groups ()[0 ]
315323 # Convert to uppercase
@@ -321,22 +329,22 @@ def standardize_jira_ref(text):
321329 if (pattern .search (text ) is not None ):
322330 text = pattern .search (text ).groups ()[0 ]
323331
324- # Assemble full text (module(s), JIRA ref(s), remaining text)
325- if (len (components ) < 1 ):
326- components = ""
327- component_text = ' ' .join (components ).strip ()
332+ # Assemble full text (JIRA ref(s), module(s), remaining text)
328333 if (len (jira_refs ) < 1 ):
329334 jira_ref_text = ""
330335 jira_ref_text = ' ' .join (jira_refs ).strip ()
336+ if (len (components ) < 1 ):
337+ components = ""
338+ component_text = ' ' .join (components ).strip ()
331339
332340 if (len (jira_ref_text ) < 1 and len (component_text ) < 1 ):
333341 clean_text = text .strip ()
334342 elif (len (jira_ref_text ) < 1 ):
335343 clean_text = component_text + ' ' + text .strip ()
336344 elif (len (component_text ) < 1 ):
337- clean_text = jira_ref_text + ': ' + text .strip ()
345+ clean_text = jira_ref_text + ' ' + text .strip ()
338346 else :
339- clean_text = component_text + ' ' + jira_ref_text + ': ' + text .strip ()
347+ clean_text = jira_ref_text + ' ' + component_text + ' ' + text .strip ()
340348
341349 return clean_text
342350
0 commit comments