Skip to content

refactor: align codebase with STANDARDS.md#160

Open
rianjs wants to merge 5 commits intomainfrom
refactor/standards-alignment
Open

refactor: align codebase with STANDARDS.md#160
rianjs wants to merge 5 commits intomainfrom
refactor/standards-alignment

Conversation

@rianjs
Copy link
Contributor

@rianjs rianjs commented Feb 16, 2026

Summary

Comprehensive refactoring to align the codebase with STANDARDS.md conventions. Covers all three modules (shared, cfl, jtk) across 198 files.

  • Replace testify with stdlib test helpers via shared/testutil package (Section 14)
  • Add context.Context as first parameter to all 58+ jtk API methods (Section 5)
  • Convert 198 "failed to X" error wraps to noun-phrase style "Xing:" (Section 4)
  • Enable revive, gosec, errorlint, exhaustive linters across all modules (Section 1)
  • Add tests for 7 previously untested jtk command packages (attachments, boards, completion, me, root, sprints, users)

Closes #159

Test plan

  • make all passes (build + test + lint) — 41 packages, 0 failures, 0 lint issues
  • grep -r "stretchr/testify" tools/ shared/ --include="*.go" returns 0 matches
  • All 5 commits build independently
  • New test files follow existing patterns (httptest, table-driven, testutil assertions)

Replace all testify/assert and testify/require usage across 69 test
files with shared/testutil assertion helpers. This aligns with
STANDARDS.md Section 14: no testify, no gomega, no ginkgo.

- Add shared/testutil/assert.go with Equal, NoError, Contains, True,
  False, Nil, NotNil, Len, Empty, and Require* variants
- Convert all test files in shared/, tools/cfl/, and tools/jtk/
- Remove testify dependency from all three go.mod files
- Add STANDARDS.md to repo root
- Update docs to reference shared/testutil

Refs #159
Remove hardcoded context.Background() convenience wrappers from the jtk
API client and add context.Context as the first parameter to all 58+
exported API methods, matching the pattern already used by the cfl tool.
Update all command callers to pass cmd.Context() and all tests to pass
context.Background().
Replace "failed to X:" error context with gerund noun phrases ("Xing:")
across all 56 source files and 16 test files. Convert sentinel errors
in jtk/api/client.go from fmt.Errorf to errors.New.
Add revive, gosec, errorlint, and exhaustive to golangci-lint configs
for all three modules (shared, cfl, jtk) per STANDARDS.md Section 1.

Fix all violations:
- errorlint: use errors.Is() instead of == for error comparisons
- exhaustive: add missing cases to switch statements
- gosec: handle errors from w.Write/json.Encode in test handlers,
  use restrictive file permissions (0600/0750), add nolint for
  intentional os.Open/exec.Command usage
- revive: rename unused parameters to _, add package doc comments,
  fix exported type/const documentation, add nolint for intentional
  api package name

Refs #159
Add comprehensive test coverage for all previously untested jtk
command packages:

- root: command structure, flags, defaults, View(), SetAPIClient()
- boards: list (table/JSON/empty), get (table/JSON/invalid ID)
- completion: bash/zsh/fish/powershell shell completion output
- me: table/JSON/plain output, email handling, auth failure
- users: search (table/JSON/empty, active/inactive filtering)
- sprints: list/current/issues/add with table/JSON/empty/error cases
- attachments: list/add/get/delete with file I/O and API mocking

58 new tests total, all using httptest and shared/testutil assertions.

Refs #159
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: align codebase with STANDARDS.md

1 participant

Comments