Pick words only when searching for Jira issues#4885
Conversation
The issue / pull request summaries can contain various funny characters which can break the search, e.g. #4873. Let's pick just the words to prevent similar problems.
There was a problem hiding this comment.
Code Review
This pull request updates the Jira issue search logic in scripts/sprint-sync to use regex for sanitizing GitHub item titles. Feedback indicates that titles without word characters could result in empty JQL queries and script crashes, suggesting a check to return early in such cases.
|
|
||
| # Fall back to title search and verify via remote links | ||
| title = github_item.title.replace('\\', '\\\\').replace("'", "\\'").replace('"', '') | ||
| title = " ".join(re.findall(r'\w+', github_item.title)) |
There was a problem hiding this comment.
Handle cases where the title contains no word characters (e.g., only symbols). An empty title string would result in an invalid JQL query (summary ~ "") and cause the script to crash.
| title = " ".join(re.findall(r'\w+', github_item.title)) | |
| words = re.findall(r'\w+', github_item.title) | |
| if not words: | |
| return [] | |
| title = " ".join(words) |
There was a problem hiding this comment.
[Question] should allow atleast '-' it will improve search accuracy ?
|
|
||
| # Fall back to title search and verify via remote links | ||
| title = github_item.title.replace('\\', '\\\\').replace("'", "\\'").replace('"', '') | ||
| title = " ".join(re.findall(r'\w+', github_item.title)) |
There was a problem hiding this comment.
From the example given
Packaged helper scripts are using the
#!/usr/bin/bashshebang
results into
Packaged helper scripts are using the usr bin bash shebang
That doesn't seem right. On the other hand using the quotation marks seems to work fine without much escaping
https://redhat.atlassian.net/issues?jql=project%20%3D%20%22Test%20Management%20Tool%22%20AND%20summary%20~%20%22%5C%22Packaged%20helper%20scripts%20are%20using%20the%20%60%23!%2Fusr%2Fbin%2Fbash%60%20shebang%5C%22%22
The issue / pull request summaries can contain various funny characters which can break the search, e.g. #4873. Let's pick just the words to prevent similar problems.
Pull Request Checklist