diff options
| author | Craig Jennings <c@cjennings.net> | 2025-11-08 11:33:31 -0600 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2025-11-08 11:33:31 -0600 |
| commit | 19e88c1ed7ecde966372adefeb3d468374ef1dd7 (patch) | |
| tree | 43515c57ad96fcc60f9be57bce7e2938e5e954b1 /assets | |
| parent | 47130cec2000f741bdcf61827c03226fd0301bc0 (diff) | |
refactor: config: replace magic numbers with named constants
Replace two magic numbers with self-documenting constants:
1. Cache cleanup percentage (line 395):
- Before: (dotimes (_ (/ (length entries) 5))
- After: (dotimes (_ (floor (* (length entries) wttrin--cache-cleanup-percentage)))
- Added: wttrin--cache-cleanup-percentage constant (0.20 = 20%)
- Explains WHY 20%: provides buffer before next cleanup cycle
2. Mode-line startup delay (line 508):
- Before: (run-at-time 3 nil #'wttrin--mode-line-fetch-weather)
- After: (run-at-time wttrin-mode-line-startup-delay nil ...)
- Added: wttrin-mode-line-startup-delay defcustom (default 3 seconds)
- Now user-customizable, range 1-5 seconds recommended
Added comprehensive tests (8 tests, all passing):
- 5 tests verify cache cleanup behavior (removes ~20% of oldest entries)
- 3 tests verify startup delay defcustom exists and has reasonable value
Benefits:
- Self-documenting code (explains WHY these values exist)
- Startup delay is now user-customizable
- Easier for future maintainers to understand rationale
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'assets')
0 files changed, 0 insertions, 0 deletions
