Skip to content

Commit da1ca94

Browse files
alexluongclaude
andcommitted
chore: remove redundant inline comments
Remove comments that simply restate what the next line of code does, such as "// Create client" before NewClient() or "// Check if exists" before .Exists(). Preserves all meaningful comments including godoc, section headers, WHY explanations, and unit clarifications. Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent caa2fd7 commit da1ca94

File tree

22 files changed

+1
-90
lines changed

22 files changed

+1
-90
lines changed

cmd/publish/publish_http.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,11 @@ const (
1616
func publishHTTP(body map[string]interface{}) error {
1717
log.Printf("[x] Publishing HTTP")
1818

19-
// make HTTP POST request to the URL specified in the body
20-
2119
jsonData, err := json.Marshal(body)
2220
if err != nil {
2321
return fmt.Errorf("failed to marshal body to JSON: %w", err)
2422
}
2523

26-
// Make HTTP POST request
2724
req, err := http.NewRequest("POST", ServerURL, bytes.NewBuffer(jsonData))
2825
if err != nil {
2926
return fmt.Errorf("failed to create HTTP request: %w", err)
@@ -37,7 +34,6 @@ func publishHTTP(body map[string]interface{}) error {
3734
}
3835
defer resp.Body.Close()
3936

40-
// Check for non-200 status code
4137
if resp.StatusCode != http.StatusOK {
4238
return fmt.Errorf("received non-200 response: %d", resp.StatusCode)
4339
}

internal/alert/evaluator.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ func NewAlertEvaluator(thresholds []int, autoDisableFailureCount int) AlertEvalu
3939
})
4040
}
4141

42-
// Sort by failure count
4342
sort.Slice(finalThresholds, func(i, j int) bool { return finalThresholds[i].failures < finalThresholds[j].failures })
4443

4544
// Check if we need to add 100

internal/alert/monitor.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ func (m *alertMonitor) HandleAttempt(ctx context.Context, attempt DeliveryAttemp
148148
return fmt.Errorf("failed to get alert state: %w", err)
149149
}
150150

151-
// Check if we should send an alert
152151
level, shouldAlert := m.evaluator.ShouldAlert(count)
153152
if !shouldAlert {
154153
return nil

internal/alert/notifier.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,32 +110,27 @@ func NewHTTPAlertNotifier(callbackURL string, opts ...NotifierOption) AlertNotif
110110
}
111111

112112
func (n *httpAlertNotifier) Notify(ctx context.Context, alert Alert) error {
113-
// Marshal alert to JSON
114113
body, err := alert.MarshalJSON()
115114
if err != nil {
116115
return fmt.Errorf("failed to marshal alert: %w", err)
117116
}
118117

119-
// Create request
120118
req, err := http.NewRequestWithContext(ctx, http.MethodPost, n.callbackURL, bytes.NewReader(body))
121119
if err != nil {
122120
return fmt.Errorf("failed to create request: %w", err)
123121
}
124122

125-
// Set headers
126123
req.Header.Set("Content-Type", "application/json")
127124
if n.bearerToken != "" {
128125
req.Header.Set("Authorization", "Bearer "+n.bearerToken)
129126
}
130127

131-
// Send request
132128
resp, err := n.client.Do(req)
133129
if err != nil {
134130
return fmt.Errorf("failed to send alert: %w", err)
135131
}
136132
defer resp.Body.Close()
137133

138-
// Check response status
139134
if resp.StatusCode >= 400 {
140135
return fmt.Errorf("alert callback failed with status %d", resp.StatusCode)
141136
}

internal/alert/store.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ func (s *redisAlertStore) IncrementConsecutiveFailureCount(ctx context.Context,
4242
incrCmd := pipe.Incr(ctx, key)
4343
pipe.Expire(ctx, key, 24*time.Hour)
4444

45-
// Execute the transaction
4645
_, err := pipe.Exec(ctx)
4746
if err != nil {
4847
return 0, fmt.Errorf("failed to execute consecutive failure count transaction: %w", err)

internal/app/app.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,21 +121,17 @@ func (a *App) PostRun(ctx context.Context) {
121121
}
122122

123123
func (a *App) run(ctx context.Context) error {
124-
// Set up cancellation context
125124
ctx, cancel := context.WithCancel(ctx)
126125
defer cancel()
127126

128-
// Handle sigterm and await termChan signal
129127
termChan := make(chan os.Signal, 1)
130128
signal.Notify(termChan, syscall.SIGINT, syscall.SIGTERM)
131129

132-
// Run workers in goroutine
133130
errChan := make(chan error, 1)
134131
go func() {
135132
errChan <- a.supervisor.Run(ctx)
136133
}()
137134

138-
// Wait for either termination signal or worker failure
139135
var exitErr error
140136
select {
141137
case <-termChan:
@@ -202,7 +198,6 @@ func (a *App) initializeRedis(ctx context.Context) error {
202198
}
203199
a.redisClient = redisClient
204200

205-
// Run Redis schema migrations
206201
if err := runRedisMigrations(ctx, redisClient, a.logger, a.config.DeploymentID); err != nil {
207202
a.logger.Error("Redis migration failed", zap.Error(err))
208203
return err

internal/app/installation.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,10 @@ func getInstallation(ctx context.Context, redisClient redis.Cmdable, telemetryCo
2121
// First attempt: try to get existing installation ID
2222
installationID, err := redisClient.HGet(ctx, outpostrcKey, installationKey).Result()
2323
if err == nil {
24-
// Installation ID already exists
2524
return installationID, nil
2625
}
2726

2827
if err != redis.Nil {
29-
// Unexpected error
3028
return "", err
3129
}
3230

@@ -41,7 +39,6 @@ func getInstallation(ctx context.Context, redisClient redis.Cmdable, telemetryCo
4139
}
4240

4341
if wasSet {
44-
// We successfully set the installation ID
4542
return newInstallationID, nil
4643
}
4744

internal/app/migration.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ func runMigration(ctx context.Context, cfg *config.Config, logger *logging.Logge
5151
}
5252

5353
if err == nil {
54-
// Migration succeeded
5554
if versionJumped > 0 {
5655
logger.Info("migrations applied",
5756
zap.Int("version", version),
@@ -88,7 +87,6 @@ func runMigration(ctx context.Context, cfg *config.Config, logger *logging.Logge
8887
case <-ctx.Done():
8988
return ctx.Err()
9089
case <-time.After(retryDelay):
91-
// Continue to next attempt
9290
}
9391
} else {
9492
// Exhausted all retries

internal/app/redis_migration.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ func runRedisMigrations(ctx context.Context, redisClient redis.Cmdable, logger *
3535
return nil
3636
}
3737

38-
// Check if this is a lock-related error
3938
isLockError := isRedisLockError(err)
4039
lastErr = err
4140

@@ -56,7 +55,6 @@ func runRedisMigrations(ctx context.Context, redisClient redis.Cmdable, logger *
5655
case <-ctx.Done():
5756
return ctx.Err()
5857
case <-time.After(retryDelay):
59-
// Continue to next attempt
6058
}
6159
} else {
6260
logger.Error("redis migration failed after retries",
@@ -70,7 +68,6 @@ func runRedisMigrations(ctx context.Context, redisClient redis.Cmdable, logger *
7068

7169
// executeRedisMigrations creates the runner and executes migrations
7270
func executeRedisMigrations(ctx context.Context, redisClient redis.Cmdable, logger *logging.Logger, deploymentID string) error {
73-
// Create runner
7471
client, ok := redisClient.(redis.Client)
7572
if !ok {
7673
// Wrap Cmdable to implement Client interface

internal/deliverymq/messagehandler.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ func NewMessageHandler(
131131
func (h *messageHandler) Handle(ctx context.Context, msg *mqs.Message) error {
132132
task := models.DeliveryTask{}
133133

134-
// Parse message
135134
if err := task.FromMessage(msg); err != nil {
136135
return h.handleError(msg, &PreDeliveryError{err: err})
137136
}
@@ -142,13 +141,11 @@ func (h *messageHandler) Handle(ctx context.Context, msg *mqs.Message) error {
142141
zap.String("destination_id", task.DestinationID),
143142
zap.Int("attempt", task.Attempt))
144143

145-
// Get destination
146144
destination, err := h.ensurePublishableDestination(ctx, task)
147145
if err != nil {
148146
return h.handleError(msg, &PreDeliveryError{err: err})
149147
}
150148

151-
// Handle delivery
152149
err = h.idempotence.Exec(ctx, idempotencyKeyFromDeliveryTask(task), func(ctx context.Context) error {
153150
return h.doHandle(ctx, task, destination)
154151
})
@@ -230,7 +227,6 @@ func (h *messageHandler) doHandle(ctx context.Context, task models.DeliveryTask,
230227
func (h *messageHandler) logDeliveryResult(ctx context.Context, task *models.DeliveryTask, destination *models.Destination, attempt *models.Attempt, err error) error {
231228
logger := h.logger.Ctx(ctx)
232229

233-
// Set attempt fields from task
234230
attempt.TenantID = task.Event.TenantID
235231
attempt.AttemptNumber = task.Attempt
236232
attempt.Manual = task.Manual
@@ -245,7 +241,6 @@ func (h *messageHandler) logDeliveryResult(ctx context.Context, task *models.Del
245241
zap.Int("attempt", task.Attempt),
246242
zap.Bool("manual", task.Manual))
247243

248-
// Publish attempt log
249244
logEntry := models.LogEntry{
250245
Event: &task.Event,
251246
Attempt: attempt,
@@ -264,7 +259,6 @@ func (h *messageHandler) logDeliveryResult(ctx context.Context, task *models.Del
264259
return &PostDeliveryError{err: logErr}
265260
}
266261

267-
// Call alert monitor in goroutine
268262
go h.handleAlertAttempt(ctx, task, destination, attempt, err)
269263

270264
// If we have an AttemptError, return it as is

0 commit comments

Comments
 (0)