You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: Extract magic numbers and use switch statements
Code quality improvements based on code review:
- Add SpeedLimit enum with named constants for intervals and CPS limits
- minInterval (0.01s = 100 CPS)
- maxInterval (300s = 1 click per 5 min)
- safeGuardInterval (0.001s to prevent division by zero)
- Add SpeedThreshold enum with named constants for speed tiers
- CPS thresholds for formatting (high/medium/low)
- CPS thresholds for descriptions (veryFast/fast/normal)
- Interval thresholds for slow speeds (slow/verySlow)
- Refactor formatClickSpeed() to use switch statement
- Replace if/else chain with pattern matching
- More idiomatic Swift code
- Refactor describeClickSpeed() to use nested switch statements
- Primary switch on CPS for fast speeds
- Secondary switch on interval for slow speeds
- Eliminates all magic numbers
Benefits:
- Self-documenting code with clear intent
- Easier to maintain and adjust thresholds
- More idiomatic Swift patterns
- Better readability
0 commit comments