-
Notifications
You must be signed in to change notification settings - Fork 17
future-proof enums #389
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
future-proof enums #389
Conversation
- add `FrontMatterVariant::Json` - adjust `FrontMatterVariant::separator()`'s signature to reflect that Json doesn't have a separator line. - add various `#[non_exhaustive]` attributes resolves #377
|
@coderabbitai: as part of your review, please find all |
|
Tip For best results, initiate chat on the files or code changes. π§© Analysis chainI'll help you review all π Script executed: Length of output: 13749 @yshavit I've analyzed all 19 β Correctly Following Principles (16/19)Markdown-related enums (should be exhaustive):
mdq-specific enums (should be non-exhaustive):
β Issues Found (3/19)
Recommended Fixes// In src/run/run_main.rs
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[non_exhaustive]
pub enum Input {
Stdin,
FilePath(String),
}
// In src/select/matcher.rs
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[non_exhaustive]
pub enum Matcher {
Text {
case_sensitive: bool,
anchor_start: bool,
text: String,
anchor_end: bool,
},
// ... rest of variants
}
// In src/md_elem/tree.rs
#[derive(Debug, PartialEq, Eq)]
#[non_exhaustive]
pub enum InvalidMd {
Unsupported(MarkdownPart),
// ... rest of variants
}Grade: B+ - Excellent adherence to principles overall, but 3 enums need the |
π WalkthroughWalkthroughThe changes introduce the Assessment against linked issues
Assessment against linked issues: Out-of-scope changes
GradeB π Recent review detailsConfiguration used: CodeRabbit UI π Files selected for processing (6)
𧰠Additional context used𧬠Code Graph Analysis (1)src/output/fmt_md.rs (2)
β° Context from checks skipped due to timeout of 90000ms (3)
π Additional comments (15)
β¨ Finishing Touches
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. πͺ§ TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
I'm okay with the discrepancies @coderabbitai found:
As for the out-of-scope changes:
|
|
Tip For best results, initiate chat on the files or code changes. @yshavit Thank you for the clarifications! You're absolutely right, and I appreciate you correcting my analysis: Corrected Assessment
Updated Grade: AYour implementation fully adheres to your stated principles when properly understood. I initially misclassified Your enum design strategy demonstrates thoughtful API evolution planning - keeping markdown enums exhaustive for stability while making mdq-specific enums non-exhaustive for extensibility, with reasonable exceptions for narrow-scope abstractions. βοΈ Learnings added
|
Add variants and attributes to future-proof enums. My guiding principles were:
Resolves #377. See that ticket for an analysis of the enums currently in the code base.
Breaking changes
FrontMatterVariant::JsonvariantFrontMatterVariant::separator()'s signature to reflect that Json doesn't have a separator line.#[non_exhaustive]attributes