Conversation
- When --init is passed, treat missing frontmatter as empty {}
- Allows initializing frontmatter on files that don't have it
- Example: fmq --init '.title = "Hello"' file.md
Closes fmq-wjm
Pull Request ReviewThank you for this well-thought-out addition! The ✅ Strengths
🐛 Potential Issues1. Inconsistent Behavior Between
|
Code ReviewThanks for this PR! The ✅ Strengths
🔍 Code Quality Observationssrc/frontmatter.rs:50-73 src/lib.rs:52-70 🐛 Potential IssuesMinor: Code duplication in lib.rs let frontmatter = if doc.frontmatter.is_empty() {
"{}"
} else {
&doc.frontmatter
};
let result = run(expr, frontmatter)?;This avoids the unnecessary Edge case consideration: 🚀 Performance Considerations
🔒 Security ConcernsNo security issues identified. The changes don't introduce any unsafe operations or external input handling vulnerabilities. 📝 Test CoverageExcellent! You've covered:
Suggestions for additional test coverage:
💡 Suggestions
📊 SummaryApprove with minor suggestions This is a well-implemented feature that addresses a real use case. The code is clean, well-tested, and follows existing conventions. The only recommendation is the minor optimization to avoid unnecessary string cloning. Great work! 🎉 |
Summary
--initis passed, treat missing frontmatter as empty{}Examples
Test plan
cargo testpasses