Skip to content

Commit dcf2dc4

Browse files
committed
fix: simplify return statement in isDailyMetric for linting
Addresses staticcheck S1008 warning by using direct boolean return instead of if-else pattern.
1 parent de94bb2 commit dcf2dc4

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

app/metrics/metrics.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,7 @@ func (m *Manager) isDailyMetric(key string) bool {
228228

229229
// Check if we have a non-empty base name after removing date
230230
baseName := strings.Join(parts[:len(parts)-1], "_")
231-
if baseName == "" {
232-
return false
233-
}
234-
235-
return true
231+
return baseName != ""
236232
}
237233

238234
// parseDailyMetric extracts base name, session type and date from a daily metric key
@@ -244,7 +240,7 @@ func (m *Manager) parseDailyMetric(key string) (baseName, sessionType, date stri
244240

245241
parts := strings.Split(key, "_")
246242
date = parts[len(parts)-1]
247-
243+
248244
// Check if the second-to-last part is a session type
249245
if len(parts) >= 3 {
250246
potentialSessionType := parts[len(parts)-2]
@@ -254,7 +250,7 @@ func (m *Manager) parseDailyMetric(key string) (baseName, sessionType, date stri
254250
return baseName, sessionType, date
255251
}
256252
}
257-
253+
258254
// No session type found, return base name without session type
259255
baseName = strings.Join(parts[:len(parts)-1], "_")
260256
return baseName, "", date

0 commit comments

Comments
 (0)