-
-
Notifications
You must be signed in to change notification settings - Fork 1
refactor: improve CLI value parsing/docs #208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughReplaces string-based version handling with a new Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Possibly related PRs
Suggested labels
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used🧠 Learnings (6)📓 Common learnings📚 Learning: 2025-11-04T06:50:10.842ZApplied to files:
📚 Learning: 2024-11-23T06:20:11.698ZApplied to files:
📚 Learning: 2024-10-02T07:55:08.948ZApplied to files:
📚 Learning: 2024-11-23T14:10:31.760ZApplied to files:
📚 Learning: 2025-01-21T09:56:32.771ZApplied to files:
🧬 Code graph analysis (2)cpp-linter/src/clang_tools/mod.rs (1)
cpp-linter/src/cli/structs.rs (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
🔇 Additional comments (9)
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 |
A follow-up to #204 - Allow boolean options to be treated as flags if their default value is false. - Some other CLI options can now accept no value (like a flag) including `--verbosity` - Use `std::str::FromStr` trait to parse the given version: * if no value is given, then behave exactly like the `cpp-linter version` subcommand (print version and exit) * if a path is given look for clang-tools in that path. This only ensures the given path exists, not if the clang- tool is present; that is done later if the tool is needed. * expand support for version specifiers using `semver::VersionReq`. This removes the need for `lenient_semver` dependency and allows the user to specify a range of clang versions. For example, `>=14, <16`, `=12.0.1`, or simply `16` (would be treated as `=16`). See [semver::VersionReq docs][ver-req-docs] for more detail. - adjust docs to better describe accepted/possible values. Due to the changes in parsing the user-given version, there is a new enum, `ClangTool` that enforces type-safety about finding the clang tools (when they are needed). * Instead of passing the tool name (as a str), the `ClangTool` enum is used to avoid typos and convey explicit support for only clang-tidy and clang-format. * Getting the clang tool's path and version are now instance methods of the `ClangTool` enum. [ver-req-docs]: https://docs.rs/semver/1.0.27/semver/struct.VersionReq.html
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #208 +/- ##
==========================================
- Coverage 96.61% 96.53% -0.08%
==========================================
Files 14 14
Lines 2891 2999 +108
==========================================
+ Hits 2793 2895 +102
- Misses 98 104 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
* make version as path absolute * return path to exe of highest clang-tool version per requirements
fix logic op and convert path to abs dir
A follow-up to #204
false(--file-changes-only,--step-summary,--*-review, etc).--verbositystd::str::FromStrtrait to parse the given--version:cpp-linter versionsubcommand (print version and exit)semver::VersionReq. This removes the need forlenient_semverdependency and allows the user to specify a range of clang versions. For example,>=14, <16,=12.0.1, or simply16(would be treated as=16). Seesemver::VersionReqdocs for more detail.Due to the changes in parsing the user-given
--version, there is a new enum,ClangToolthat enforces type-safety about finding the clang tools (when they are needed).ClangToolenum is used to avoid typos and convey explicit support for only clang-tidy and clang-format.ClangToolenum.Summary by CodeRabbit
Refactor
Documentation
Chores