Description
The six core renderLogs* formatters in pkg/cli/ (renderLogsTSV, renderLogsTSVVerbose, renderLogsCompact, renderLogsCompactVerbose, renderLogsJSON, renderLogsConsole) write directly to os.Stdout with no io.Writer parameter. Tests work around this via a captureOutput helper that swaps os.Stdout at the OS level and is annotated as unsafe for t.Parallel(). The correct pattern already exists in audit_cross_run_render.go (renderCrossRunReportMarkdownToWriter(w io.Writer, ...)) — extend it to the log formatters.
Expected Impact
Eliminates the captureOutput OS-pipe mutex, enables t.Parallel() across 5 formatter test files, allows callers to redirect output (cmd.OutOrStdout()), and aligns the log-rendering subsystem with the existing ...ToWriter convention. ~167 hardcoded os.Stdout refs in the package, concentrated in logs_format_compact.go (39) and logs_format_tsv.go (12).
Suggested Agent
Repository Quality Improvement / Code Simplifier, or a Copilot SWE Agent PR.
Estimated Effort
Medium (1-4 hours)
Data Source
DeepReport 2026-07-22 analysis of Repository Quality report #47310.
Generated by 🔬 Deep Report · age00 213.6 AIC · ⌖ 11 AIC · ⊞ 10.3K · ◷
Description
The six core
renderLogs*formatters inpkg/cli/(renderLogsTSV,renderLogsTSVVerbose,renderLogsCompact,renderLogsCompactVerbose,renderLogsJSON,renderLogsConsole) write directly toos.Stdoutwith noio.Writerparameter. Tests work around this via acaptureOutputhelper that swapsos.Stdoutat the OS level and is annotated as unsafe fort.Parallel(). The correct pattern already exists inaudit_cross_run_render.go(renderCrossRunReportMarkdownToWriter(w io.Writer, ...)) — extend it to the log formatters.Expected Impact
Eliminates the
captureOutputOS-pipe mutex, enablest.Parallel()across 5 formatter test files, allows callers to redirect output (cmd.OutOrStdout()), and aligns the log-rendering subsystem with the existing...ToWriterconvention. ~167 hardcodedos.Stdoutrefs in the package, concentrated inlogs_format_compact.go(39) andlogs_format_tsv.go(12).Suggested Agent
Repository Quality Improvement / Code Simplifier, or a Copilot SWE Agent PR.
Estimated Effort
Medium (1-4 hours)
Data Source
DeepReport 2026-07-22 analysis of Repository Quality report #47310.