From 570bb176e821f63106c4cf9e1bec7c7be852c692 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Thu, 8 Oct 2026 23:20:51 -0400 Subject: [PATCH] Comment check: multi-line block comments in .ts and .css --- tests/scripts/comments-rules.sh | 10 ++++++++++ tests/scripts/comments.py | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/scripts/comments-rules.sh b/tests/scripts/comments-rules.sh index 944a88c..4fb8f81 100755 --- a/tests/scripts/comments-rules.sh +++ b/tests/scripts/comments-rules.sh @@ -20,6 +20,16 @@ printf 'const a = 1 /* A comment\n spanning lines. */\n' >"$work/apps/a/web/sr printf '// One two three four five six seven eight nine ten eleven.\n' >"$work/apps/a/web/src/a.js" ! check || fail "an eleven-word JS comment passed" rm "$work/apps/a/web/src/a.js" +mkdir -p "$work/site/src" +for ext in ts css; do + printf '/* A comment\n spanning lines. */\n' >"$work/site/src/a.$ext" + ! check || fail "a multi-line .$ext block comment passed" + printf '/* One two three four five six seven eight nine ten eleven. */\n' >"$work/site/src/a.$ext" + ! check || fail "an eleven-word .$ext comment passed" + printf '/* One short line. */\n' >"$work/site/src/a.$ext" + check || fail "a short .$ext comment failed" + rm "$work/site/src/a.$ext" +done printf '// One two three four five six seven eight nine ten eleven.\n' >"$work/tests/scripts/a.swift" ! check || fail "an eleven-word Swift comment passed" echo "ok: comment rules" diff --git a/tests/scripts/comments.py b/tests/scripts/comments.py index a85a59e..613ddce 100755 --- a/tests/scripts/comments.py +++ b/tests/scripts/comments.py @@ -65,7 +65,7 @@ for pattern in PATTERNS: if line.startswith("#!"): continue # A block comment left open spans lines. - if path.suffix in (".c", ".h", ".js") and re.search(r"/\*(?!.*\*/)", line): + if path.suffix in (".c", ".h", ".js", ".ts", ".css") and re.search(r"/\*(?!.*\*/)", line): repeated.setdefault(path, number) match = comment.match(line) said = match and next(group for group in match.groups() if group is not None)