Fix revive style issues (bd-56)

- Fix 14 unused-parameter warnings (rename to _)
- Fix 2 redefines-builtin-id (max→maxCount, min→minInt)
- Fix 3 indent-error-flow issues with gofmt
- Merged duplicate bd-126 into bd-116
This commit is contained in:
Steve Yegge
2025-10-25 18:13:49 -07:00
parent 14e14f647e
commit bb33007036
17 changed files with 93 additions and 92 deletions

View File

@@ -225,9 +225,9 @@ func calculateLatencyStats(samples []time.Duration) LatencyStats {
n := len(sorted)
// Calculate percentiles with defensive clamping
p50Idx := min(n-1, n*50/100)
p95Idx := min(n-1, n*95/100)
p99Idx := min(n-1, n*99/100)
p50Idx := minInt(n-1, n*50/100)
p95Idx := minInt(n-1, n*95/100)
p99Idx := minInt(n-1, n*99/100)
// Calculate average
var sum time.Duration
@@ -251,7 +251,7 @@ func calculateLatencyStats(samples []time.Duration) LatencyStats {
}
}
func min(a, b int) int {
func minInt(a, b int) int {
if a < b {
return a
}

View File

@@ -140,7 +140,7 @@ func NewServer(socketPath string, store storage.Storage) *Server {
}
// Start starts the RPC server and listens for connections
func (s *Server) Start(ctx context.Context) error {
func (s *Server) Start(_ context.Context) error {
if err := s.ensureSocketDir(); err != nil {
return fmt.Errorf("failed to ensure socket directory: %w", err)
}

View File

@@ -294,7 +294,7 @@ func deduplicateIncomingIssues(issues []*types.Issue) []*types.Issue {
// If an error occurs partway through, some issues may be created without their references
// being updated. This is a known limitation that requires storage layer refactoring to fix.
// See issue bd-25 for transaction support.
func RemapCollisions(ctx context.Context, s *SQLiteStorage, collisions []*CollisionDetail, allIssues []*types.Issue) (map[string]string, error) {
func RemapCollisions(ctx context.Context, s *SQLiteStorage, collisions []*CollisionDetail, _ []*types.Issue) (map[string]string, error) {
idMapping := make(map[string]string)
// Sync counters before remapping to avoid ID collisions

View File

@@ -1524,7 +1524,7 @@ func (s *SQLiteStorage) resolveDeleteSet(ctx context.Context, tx *sql.Tx, ids []
return ids, s.trackOrphanedIssues(ctx, tx, ids, idSet, result)
}
func (s *SQLiteStorage) expandWithDependents(ctx context.Context, tx *sql.Tx, ids []string, idSet map[string]bool) ([]string, error) {
func (s *SQLiteStorage) expandWithDependents(ctx context.Context, tx *sql.Tx, ids []string, _ map[string]bool) ([]string, error) {
allToDelete, err := s.findAllDependentsRecursive(ctx, tx, ids)
if err != nil {
return nil, fmt.Errorf("failed to find dependents: %w", err)