Skip to content

refactor: remove duplicate helper functions #21

@rianjs

Description

@rianjs

Summary

Remove duplicate utility functions that exist in multiple places, using the shared package versions instead.

Duplicated Functions

truncate()

Implemented in 3 places:

  • shared/view/view.go lines 201-209 ✓ (keep this one)
  • tools/cfl/internal/view/view.go lines 218-226 (remove)
  • tools/jtk/internal/cmd/issues/get.go lines 99-104 (remove)

formatAssignee() / orDash()

tools/jtk/internal/cmd/issues/get.go:

  • formatAssignee() (lines 92-96) - defined but same logic is inline at line 54
  • orDash() (lines 106-111) - utility for empty string handling
  • safeString() (lines 113-120) - interface to string conversion

Proposed Changes

  1. Remove duplicate truncate() implementations, use shared/view.Truncate()
  2. Remove unused formatAssignee() or use it consistently
  3. Consider moving orDash() and safeString() to shared if used elsewhere

Impact

~40 lines removed

Depends On

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions