Fix specific month descriptions#21
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughCron human-readable rendering now resolves specific month values into localized month names, preserves month-step and wildcard month phrasing, and adds tests for month/day cases and multi-language month-name output. ChangesLocalized month phrasing
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This pull request fixes human-readable cron descriptions so that concrete month values (1–12) are reflected in the output, addressing cases where the month field was previously ignored (e.g., “March”/“December” now appear in yearly phrases when appropriate).
Changes:
- Adds month-name localization and new phrase templates to support “every year on {Month} {Day}” and “every day in {Month}” scenarios.
- Extends the phrase builder to handle specific month values and month-step expressions (
*/N) when day-of-month is a wildcard. - Adds unit tests covering specific month, wildcard month, month-step, and localized month-name output.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| CronCraft/Extensions/CronHelper.cs | Adds localized month name lookup and updates human-readable phrase construction to incorporate specific month values and month steps. |
| CronCraft.Test/CronHelperTest.cs | Adds tests validating specific-month phrasing and month-name localization across supported languages. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (dayOfWeek != "*" && dayOfMonth == "*") | ||
| { | ||
| if (TryGetMonthName(month, settings.Language, out var monthName)) | ||
| return $"{Phrase("EveryDayOfWeek", JoinDays(dayOfWeek, daysMap))} in {monthName} {Phrase("AtTime", time)}"; | ||
|
|
||
| return $"{Phrase("EveryDayOfWeek", JoinDays(dayOfWeek, daysMap))} {Phrase("AtTime", time)}"; |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@CronCraft/Extensions/CronHelper.cs`:
- Around line 309-314: The weekday-in-month branch in CronHelper should not
concatenate the hard-coded word “in” with localized phrases. Update the
`TryGetMonthName` path in `CronHelper` to use a language-specific template such
as `EveryDayOfWeekInMonth` instead of building the string inline, keeping
`Phrase("EveryDayOfWeek", ...)`, `JoinDays(...)`, and `Phrase("AtTime", ...)`
consistent. Add or update a non-English test covering this branch to verify the
localized output for a value like `0 9 * 3 1`.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: dd5f7e7d-7486-4e9c-89d8-da38e7f24acb
📒 Files selected for processing (2)
CronCraft.Test/CronHelperTest.csCronCraft/Extensions/CronHelper.cs
Summary
Closes #13.
Fixes human-readable cron output so concrete month values are no longer ignored. Expressions such as
0 9 1 3 *now describe the month as March instead of falling back to the generic monthly phrasing.Changes
*still produces the existing monthly/daily output.*/6still produces “Every 6 months on the 27th …”.Validation
dotnet test CronCraft.sln --no-restoredotnet build CronCraft.sln --configuration Release --no-restoredotnet test CronCraft.sln --configuration Release --no-buildgit diff --checkSummary by CodeRabbit