Skip to content
Draft
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions core/todo_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ def scan_file_for_todos(
if allowed_tags and tag not in allowed_tags:
continue

# Schließende Kommentarzeichen (*/ oder -->) am Zeilenende entfernen
text = re.sub(r'(\*/|-->)\s*$', '', raw_text).strip()
# Kommentar-Endzeichen für die Anzeige entfernen, kein HTML-Sanitizer.
text = re.sub(r'(\*/|--!?>)\s*$', '', raw_text).strip()

items.append(
TodoItem(
Expand Down
26 changes: 26 additions & 0 deletions tests/test_todo_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,32 @@ def test_scan_file_for_todos(tmp_path):
assert items[2].line_number == 5


def test_scan_file_comment_terminators_preserve_task_text(tmp_path):
test_file = tmp_path / "comments.html"
test_file.write_text(
"<!-- TODO: Standard ending -->\n"
"<!-- FIXME(anna): Bang ending --!> \n"
"/* BUG: C ending */\n"
"<!-- NOTE: Keep <b>literal markup</b> --!>\n"
"<!-- HACK: Keep unsupported ending --!!>\n"
"<!-- TODO: Keep --> inside text\n",
encoding="utf-8",
)

items = scan_file_for_todos(test_file)
assert [item.text for item in items] == [
"Standard ending",
"Bang ending",
"C ending",
"Keep <b>literal markup</b>",
"Keep unsupported ending --!!>",
"Keep --> inside text",
]
assert items[1].author == "anna"
assert items[1].line_number == 2
assert items[1].line_text == "<!-- FIXME(anna): Bang ending --!> "


def test_scan_file_binary_and_size_limits(tmp_path):
"""Prüft, dass Binärdateien und übergroße Dateien übersprungen werden."""
bin_file = tmp_path / "binary.dat"
Expand Down
Loading