Files
kevinveenbirkenbachandClaude Opus 5 5137465c6f style: delete every comment the comments-valid policy rejects
3529 invalid comments in 528 files, grandfathered in while the linter
only saw the working-tree diff. Removal ran through the linter's own
collectors, so detection and deletion cannot drift: a comment whose
opener line is blank before it and whose closer line is blank after it
loses all its lines, anything else loses only the comment region, and a
line left holding a bare delimiter goes with it.

Five files keep their comments behind a nocheck marker instead. Four are
upstream configs whose inline docs are upstream's own (mautrix, systemd
journald, nextcloud-oidc-login, MediaWiki). In littlejs the
commented-out entries ARE the deactivation mechanism for an example
tile, so deleting them would delete configuration.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 03:22:02 +02:00

72 lines
1.5 KiB
Python

from __future__ import annotations
import subprocess
import sys
import threading
from typing import TextIO
def _drain_stream(
stream: TextIO,
*,
sink: TextIO,
) -> None:
"""
Read a text stream line-by-line and write to sink.
"""
try:
for line in iter(stream.readline, ""):
sink.write(line)
sink.flush()
finally:
try:
stream.close()
except Exception as exc:
sys.stderr.write(f"Warning: failed to close stream {stream!r}: {exc}\n")
sys.stderr.flush()
def run_streaming(
cmd: list[str],
*,
cwd,
env: dict[str, str],
text: bool = True,
) -> subprocess.CompletedProcess:
"""
Run a subprocess and stream stdout/stderr live to the terminal.
"""
p = subprocess.Popen(
cmd,
cwd=cwd,
env=env,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=text,
bufsize=1,
)
assert p.stdout is not None # noqa: S101
assert p.stderr is not None # noqa: S101
t_out = threading.Thread(
target=_drain_stream,
kwargs={"stream": p.stdout, "sink": sys.stdout},
)
t_err = threading.Thread(
target=_drain_stream,
kwargs={"stream": p.stderr, "sink": sys.stderr},
)
t_out.daemon = True
t_err.daemon = True
t_out.start()
t_err.start()
rc = p.wait()
t_out.join()
t_err.join()
return subprocess.CompletedProcess(cmd, rc)