refactor(progress): extract bar styling into styleBar function + add tests #153

Merged
fuzzy merged 2 commits from fix/progress-bar into main 2026-07-14 05:50:32 +00:00
Owner

What

Extract duplicated bar styling into a styleBar() helper function. Add custom colored bar characters using konsoru color/style. Guard Done() against double-close. Add package doc comment and unit tests for the progress Tracker.

Why

  • Removes 10 lines of duplicated config in New() and SetTotal()
  • Prevents panic if Done() is called multiple times
  • Provides basic test coverage for the progress package (8 tests)

Testing

  • go test ./internal/progress/... — 8 tests, all pass
  • go vet ./... — passes
  • go build ./... — passes
  • Pre-commit hooks — pass

Breaking Changes

None

Notes

  • Bar uses cyan filled blocks () on dark background for visual polish
  • Done() now uses select guard to prevent panic on double-close
  • Done() updates current to total for consistent state
## What Extract duplicated bar styling into a `styleBar()` helper function. Add custom colored bar characters using konsoru color/style. Guard `Done()` against double-close. Add package doc comment and unit tests for the progress Tracker. ## Why - Removes 10 lines of duplicated config in `New()` and `SetTotal()` - Prevents panic if `Done()` is called multiple times - Provides basic test coverage for the progress package (8 tests) ## Testing - `go test ./internal/progress/...` — 8 tests, all pass - `go vet ./...` — passes - `go build ./...` — passes - Pre-commit hooks — pass ## Breaking Changes None ## Notes - Bar uses cyan filled blocks (`━`) on dark background for visual polish - `Done()` now uses `select` guard to prevent panic on double-close - `Done()` updates `current` to `total` for consistent state
refactor: extract bar styling into separate function
Some checks failed
Test and Release / lint (pull_request) Has been cancelled
Test and Release / test (pull_request) Has been cancelled
ffce4945cf
fuzzy self-assigned this 2026-07-14 05:41:16 +00:00
fuzzy scheduled this pull request to auto merge when all checks succeed 2026-07-14 05:41:19 +00:00
fuzzy canceled auto merging this pull request when all checks succeed 2026-07-14 05:42:24 +00:00
test(progress): add unit tests and package doc for progress tracker
All checks were successful
Test and Release / test (pull_request) Successful in 6m2s
Test and Release / lint (pull_request) Successful in 6m55s
6cda048241
- Add package doc comment for progress package
- Add unit tests covering New, Add, SetTotal, Done lifecycle
- Fix Done() to guard against double-close
- Fix Done() to update current counter on completion
the.auditor changed title from refactor: extract bar styling into separate function to refactor(progress): extract bar styling into styleBar function + add tests 2026-07-14 05:43:39 +00:00
the.auditor left a comment

Review: APPROVED

Changes

  • internal/progress/progress.go — Extracted styleBar() removing 10 lines of duplication; added konsoru color/style imports for cyan bar chars; guarded Done() against double-close; updated current to total on completion; added package doc comment
  • internal/progress/progress_test.go (new) — 8 unit tests covering New, Add, SetTotal, Done lifecycle, and double-close safety

Verification

  • go vet ./...
  • go build ./...
  • go test ./... all pass
  • Pre-commit hooks — all pass

Key points

  • styleBar() consolidates bar config in one place
  • Double-Done() is safe via select guard
  • Renamed from "refactor: extract bar styling" to match full scope
## Review: APPROVED ### Changes - `internal/progress/progress.go` — Extracted `styleBar()` removing 10 lines of duplication; added konsoru color/style imports for cyan bar chars; guarded `Done()` against double-close; updated `current` to `total` on completion; added package doc comment - `internal/progress/progress_test.go` (new) — 8 unit tests covering New, Add, SetTotal, Done lifecycle, and double-close safety ### Verification - `go vet ./...` — ✅ - `go build ./...` — ✅ - `go test ./...` — ✅ all pass - Pre-commit hooks — ✅ all pass ### Key points - `styleBar()` consolidates bar config in one place - Double-`Done()` is safe via `select` guard - Renamed from "refactor: extract bar styling" to match full scope
fuzzy scheduled this pull request to auto merge when all checks succeed 2026-07-14 05:45:03 +00:00
fuzzy merged commit 6cda048241 into main 2026-07-14 05:50:32 +00:00
fuzzy deleted branch fix/progress-bar 2026-07-14 05:50:32 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
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
thwap/pget!153
No description provided.