[GH-ISSUE #166] Audit: Minor code quality improvements #48

Closed
opened 2026-02-26 21:32:59 +03:00 by kerem · 0 comments
Owner

Originally created by @rudrankriyam on GitHub (Jan 25, 2026).
Original GitHub issue: https://github.com/rudrankriyam/App-Store-Connect-CLI/issues/166

Description

Group of minor code quality issues found during audit.


1. ANSI Escape Codes Cross-Platform Support

cmd/shared.go:20-23 uses ANSI escape codes that may not work on all terminals (Windows cmd, some IDEs):

var (
    bold  = "\033[1m"
    reset = "\033[22m"
)

Consider: Using a library like github.com/mattn/go-colorful for cross-platform support.


2. Retry Logging to stderr

internal/asc/client_core.go:204 uses fmt.Fprintf for retry logging:

fmt.Fprintf(os.Stderr, "retrying in %s (attempt %d/%d): %v\n", ...)

Consider: Using a proper logging package (e.g., slog in Go 1.21+) instead of fmt.Fprintf for better control and structured output.


3. Config Timeout Fields as Strings

internal/config/config.go:28-35 stores timeouts as strings:

Timeout              string `json:"timeout"`
TimeoutSeconds       string `json:"timeout_seconds"`

Consider: Using time.Duration type directly in the struct instead of storing as strings, though this requires JSON serialization changes.


Severity

Low

Originally created by @rudrankriyam on GitHub (Jan 25, 2026). Original GitHub issue: https://github.com/rudrankriyam/App-Store-Connect-CLI/issues/166 ## Description Group of minor code quality issues found during audit. --- ### 1. ANSI Escape Codes Cross-Platform Support `cmd/shared.go:20-23` uses ANSI escape codes that may not work on all terminals (Windows cmd, some IDEs): ```go var ( bold = "\033[1m" reset = "\033[22m" ) ``` **Consider:** Using a library like `github.com/mattn/go-colorful` for cross-platform support. --- ### 2. Retry Logging to stderr `internal/asc/client_core.go:204` uses `fmt.Fprintf` for retry logging: ```go fmt.Fprintf(os.Stderr, "retrying in %s (attempt %d/%d): %v\n", ...) ``` **Consider:** Using a proper logging package (e.g., `slog` in Go 1.21+) instead of `fmt.Fprintf` for better control and structured output. --- ### 3. Config Timeout Fields as Strings `internal/config/config.go:28-35` stores timeouts as strings: ```go Timeout string `json:"timeout"` TimeoutSeconds string `json:"timeout_seconds"` ``` **Consider:** Using `time.Duration` type directly in the struct instead of storing as strings, though this requires JSON serialization changes. --- ## Severity Low
kerem closed this issue 2026-02-26 21:32:59 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/App-Store-Connect-CLI#48
No description provided.