Repository navigation
refactor: replace all unwrap() calls in src/commands/ with expect() - #224
Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 0 minutes and 22 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (27)
📝 WalkthroughWalkthroughThis pull request systematically replaces 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #224 +/- ##
==========================================
+ Coverage 88.88% 88.94% +0.05%
==========================================
Files 113 113
Lines 53521 53807 +286
==========================================
+ Hits 47574 47856 +282
- Misses 5947 5951 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/commands/simulate/common.rs (1)
655-657: Message overstates what this test validates.Line 655 only tests
"lognormal"lowercase, but theexpecttext says case-insensitive acceptance. Either adjust the message to lowercase-specific behavior or add an uppercase case in this test.Suggested minimal fix
- .expect("case-insensitive distribution name should be accepted"); + .expect("lowercase distribution name should be accepted");🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/commands/simulate/common.rs` around lines 655 - 657, The test message overclaims case-insensitivity for to_family_size_distribution(): either change the expect() text to only refer to the lowercase input (e.g., "lowercase distribution name should be accepted") or add an explicit uppercase test by creating an args_upper (e.g., with "LogNormal" or "LOGNORMAL") and calling to_family_size_distribution() on it and expecting success; update the assertion(s) around args_lower and/or add the args_upper assertion so the test name accurately matches the behavior of to_family_size_distribution().
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/commands/simulate/common.rs`:
- Around line 655-657: The test message overclaims case-insensitivity for
to_family_size_distribution(): either change the expect() text to only refer to
the lowercase input (e.g., "lowercase distribution name should be accepted") or
add an explicit uppercase test by creating an args_upper (e.g., with "LogNormal"
or "LOGNORMAL") and calling to_family_size_distribution() on it and expecting
success; update the assertion(s) around args_lower and/or add the args_upper
assertion so the test name accurately matches the behavior of
to_family_size_distribution().
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 16513140-0445-45c4-b033-9e75eaf1ecd0
📒 Files selected for processing (27)
src/commands/clip.rssrc/commands/codec.rssrc/commands/common.rssrc/commands/compare/bams.rssrc/commands/compare/raw_compare.rssrc/commands/consensus_runner.rssrc/commands/correct.rssrc/commands/dedup.rssrc/commands/downsample.rssrc/commands/duplex.rssrc/commands/duplex_metrics.rssrc/commands/extract.rssrc/commands/fastq.rssrc/commands/filter.rssrc/commands/group.rssrc/commands/merge.rssrc/commands/review.rssrc/commands/shared_metrics.rssrc/commands/simplex.rssrc/commands/simplex_metrics.rssrc/commands/simulate/common.rssrc/commands/simulate/correct_reads.rssrc/commands/simulate/fastq_reads.rssrc/commands/simulate/grouped_reads.rssrc/commands/simulate/mapped_reads.rssrc/commands/sort.rssrc/commands/zipper.rs
9abaf50 to
d80b393
Compare
Audit and replace all 527 unwrap() calls across 27 files in src/commands/. Production code unwraps are converted to expect() with invariant-documenting messages. Test code unwraps are converted to expect() with context-specific failure messages. Zero unwrap() calls remain in src/commands/.
The expect message now accurately describes what the function guarantees rather than restating the obvious precondition check.
d80b393 to
a2ac65f
Compare
Summary
unwrap()calls across 27 files insrc/commands/expect()with invariant-documenting messages explaining why the unwrap is safeexpect()with context-specific failure messages for better diagnosticsunwrap()calls remain insrc/commands/Test plan
cargo ci-test— all 2,213 tests passcargo ci-fmt— formatting cleancargo ci-lint— no warnings