The retention policy calculations use magic numbers (30 for days/month, 365 for days/year) directly in the code, making it less readable and maintainable.
DAYS_PER_MONTH=30# Approximate for retention calculationsDAYS_PER_YEAR=365# Approximate for retention calculations# Then use:thresholds["monthly"]=((now-timedelta(days=DAYS_PER_MONTH*keep_monthly))
# Magic numbers for date calculations should be named constants
**Priority:** Low
**Component:** backup.py
**Type:** Code Quality
## Description
The retention policy calculations use magic numbers (30 for days/month, 365 for days/year) directly in the code, making it less readable and maintainable.
## Location
`curateipsum/backup.py:208-214`
## Current Code
```python
if keep_monthly is not None:
thresholds["monthly"] = ((now - timedelta(days=30*keep_monthly))
.replace(day=1, hour=0, minute=0, second=0)
.strftime(BACKUP_ENT_FMT))
if keep_yearly is not None:
thresholds["yearly"] = (
(now - timedelta(days=365*keep_yearly))
.replace(month=1, day=1, hour=0, minute=0, second=0)
.strftime(BACKUP_ENT_FMT)
)
```
## Proposed Solution
```python
DAYS_PER_MONTH = 30 # Approximate for retention calculations
DAYS_PER_YEAR = 365 # Approximate for retention calculations
# Then use:
thresholds["monthly"] = ((now - timedelta(days=DAYS_PER_MONTH * keep_monthly))
```
## Impact
**Low** - Code quality issue, doesn't affect functionality.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Magic numbers for date calculations should be named constants
Priority: Low
Component: backup.py
Type: Code Quality
Description
The retention policy calculations use magic numbers (30 for days/month, 365 for days/year) directly in the code, making it less readable and maintainable.
Location
curateipsum/backup.py:208-214Current Code
Proposed Solution
Impact
Low - Code quality issue, doesn't affect functionality.