Description
pkg/console/list.go:76 uses fmt.Scanf("%d", &choice) in the non-TTY fallback path, while the rest of the function accepts a reader abstraction. This bypasses dependency injection and may read from the wrong input source in scripted or non-interactive contexts.
Suggested Changes
- Replace
fmt.Scanf("%d", &choice) with a read from the injected reader (matching the pattern in confirm.go)
- Ensure the fallback path is consistent with how
pkg/console/confirm.go handles non-interactive input
Files Affected
pkg/console/list.go (line 76)
- Reference:
pkg/console/confirm.go (pattern to follow)
Success Criteria
fmt.Scanf removed from list.go
- Non-TTY fallback reads from the injected reader
- Existing tests pass; add test for non-TTY path with a bytes.Reader if not present
Source
Extracted from Terminal Stylist Analysis #46584
Priority
Medium — Correctness issue in non-interactive/scripted usage
🔍 Task mining by Discussion Task Miner - Code Quality Improvement Agent · 40.8 AIC · ⌖ 6.1 AIC · ⊞ 7K · ◷
Description
pkg/console/list.go:76usesfmt.Scanf("%d", &choice)in the non-TTY fallback path, while the rest of the function accepts a reader abstraction. This bypasses dependency injection and may read from the wrong input source in scripted or non-interactive contexts.Suggested Changes
fmt.Scanf("%d", &choice)with a read from the injected reader (matching the pattern inconfirm.go)pkg/console/confirm.gohandles non-interactive inputFiles Affected
pkg/console/list.go(line 76)pkg/console/confirm.go(pattern to follow)Success Criteria
fmt.Scanfremoved from list.goSource
Extracted from Terminal Stylist Analysis #46584
Priority
Medium — Correctness issue in non-interactive/scripted usage