Repository navigation
Accept yes/no/y/n/t/f as boolean flag values - #235
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #235 +/- ##
=======================================
Coverage 88.97% 88.98%
=======================================
Files 113 113
Lines 55038 55065 +27
=======================================
+ Hits 48970 48998 +28
+ Misses 6068 6067 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (17)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (9)
📝 WalkthroughWalkthroughAdded 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/commands/common.rs (1)
628-634: Consider makingparse_boolcrate-private.This reads like an internal clap helper. If external crates are not meant to call it,
pub(crate)keeps the public API surface smaller.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/commands/common.rs` around lines 628 - 634, The parse_bool helper is currently exported publicly but intended as an internal clap helper; change its visibility from pub to pub(crate) on the function declaration for parse_bool to keep it crate-private, and update any internal references if necessary (search for parse_bool usages) to ensure they remain in-crate; no other behavioral changes are needed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/commands/sort.rs`:
- Around line 172-173: Remove the attribute-level conflicts on the verify flag
(the conflicts_with settings on the verify field which, combined with
ArgAction::Set, treat --verify=false as "present") and instead add runtime
validation in the command's execute() method: check if self.verify is true and
if so bail with clear errors when self.output.is_some() or self.write_index is
true (e.g., "--verify cannot be used with --output" and "--write-index cannot be
used with --verify"). Ensure the checks reference the verify field, output
option and write_index flag and run before proceeding with the rest of
execute().
---
Nitpick comments:
In `@src/commands/common.rs`:
- Around line 628-634: The parse_bool helper is currently exported publicly but
intended as an internal clap helper; change its visibility from pub to
pub(crate) on the function declaration for parse_bool to keep it crate-private,
and update any internal references if necessary (search for parse_bool usages)
to ensure they remain in-crate; no other behavioral changes are needed.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 3a25df5d-ff43-4b82-90eb-37edf063b47f
📒 Files selected for processing (17)
src/commands/clip.rssrc/commands/common.rssrc/commands/compare/bams.rssrc/commands/compare/metrics.rssrc/commands/correct.rssrc/commands/dedup.rssrc/commands/downsample.rssrc/commands/duplex_metrics.rssrc/commands/fastq.rssrc/commands/filter.rssrc/commands/group.rssrc/commands/review.rssrc/commands/simulate/consensus_reads.rssrc/commands/simulate/fastq_reads.rssrc/commands/simulate/grouped_reads.rssrc/commands/sort.rssrc/commands/zipper.rs
Add a custom `parse_bool` value parser that accepts true/false, yes/no, y/n, and t/f (case-insensitive), matching sopt/fgbio behavior. Wire it into all boolean CLI flags via `value_parser = parse_bool`. Also adds the full `num_args = 0..=1` / `default_missing_value` / `ArgAction::Set` pattern to 17 boolean flags that were still using clap's default `SetTrue` action (simulate commands, group, correct, sort, compare, and hidden scheduler flags).
9dc160d to
1d36434
Compare
Summary
parse_boolvalue parser incommon.rsthat acceptstrue/false/yes/no/y/n/t/f(case-insensitive), matching sopt/fgbio boolean flag behaviorvalue_parser = parse_boolinto all boolean CLI flags across 17 filesnum_args = 0..=1/default_missing_value = "true"/ArgAction::Setpattern to 17 flags that were still using clap's defaultSetTrueaction (simulate, group, correct, sort, compare, and hidden scheduler flags)--flag(bare),--flag true/false,--flag yes/no,--flag=t/f, etc.Test plan
parse_bool: 23 valid cases (all accepted values in various casings), 13 invalid cases (typos, nonsense, whitespace)cargo ci-fmtandcargo ci-lintclean