Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/sprint-sync
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def find_jira_issues(
return sort_by_key(results)

# 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))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
title = " ".join(re.findall(r'\w+', github_item.title))
words = re.findall(r'\w+', github_item.title)
if not words:
return []
title = " ".join(words)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Question] should allow atleast '-' it will improve search accuracy ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the example given

Packaged helper scripts are using the #!/usr/bin/bash shebang

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

query = f'project = "{JIRA_PROJECT}" AND summary ~ "{title}"'
candidates = jira.search_issues(query, maxResults=False, json_result=False)
assert isinstance(candidates, list)
Expand Down
Loading