mirror of
https://github.com/ditkrg/todo-to-issue-action.git
synced 2026-01-25 07:16:42 +00:00
fix: don't include source with issue URL comment
If TODO comment is a suffix to a line of (executable) source, don't repeat the source content when inserting the issue URL. But be sure to still keep the same alignment. Closes #229
This commit is contained in:
2
main.py
2
main.py
@@ -78,7 +78,7 @@ def process_diff(diff, client=Client(), insert_issue_urls=False, parser=TodoPars
|
||||
old_line = file_lines[line_number]
|
||||
remove = fr'(?i:{raw_issue.identifier}).*{re.escape(raw_issue.title)}'
|
||||
insert = f'Issue URL: {client.get_issue_url(new_issue_number)}'
|
||||
new_line = re.sub(remove, insert, old_line)
|
||||
new_line = re.sub('^.*'+remove, raw_issue.prefix + insert, old_line)
|
||||
# make sure the above operation worked as intended
|
||||
if new_line != old_line:
|
||||
# Check if the URL line already exists, if so abort.
|
||||
|
||||
Reference in New Issue
Block a user