-
Notifications
You must be signed in to change notification settings - Fork 60
Fail when template doesn't match any file #928
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
Fail when template doesn't match any file #928
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request adds validation to ensure template patterns match existing files when creating a TemplateEngine. The change modifies the TemplateEngine::new method to return a Result and fail early if any template pattern doesn't match any files.
- Changed
TemplateEngine::newto returnResult<Self, Error>instead ofSelf - Added validation logic to check template patterns against available files
- Updated all call sites to handle the new return type with proper error handling
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/weaver_forge/src/lib.rs | Modified TemplateEngine::new to validate templates and return Result, added test for validation |
| src/registry/update_markdown.rs | Updated to handle new Result return type from TemplateEngine::new |
| src/registry/live_check.rs | Updated to handle new Result return type from TemplateEngine::new |
| src/registry/generate.rs | Updated to handle new Result return type from TemplateEngine::new |
| src/registry/diff.rs | Updated to handle new Result return type from TemplateEngine::new |
| src/main.rs | Updated to handle new Result return type from TemplateEngine::new and improved debug logging |
| crates/weaver_semconv_gen/src/lib.rs | Updated to handle new Result return type from TemplateEngine::new |
| crates/weaver_forge/templates/wrong_config/weaver.yaml | Added test configuration with non-existent template |
| crates/weaver_forge/templates/wrong_config/exists.j2 | Added test template file |
| crates/weaver_forge/templates/whitespace_control/weaver.yaml | Removed unused template configurations |
| crates/weaver_codegen_test/templates/registry/rust/weaver.yaml | Removed unused template configurations |
| crates/weaver_codegen_test/build.rs | Updated to handle new Result return type from TemplateEngine::new |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #928 +/- ##
=====================================
Coverage 77.9% 78.0%
=====================================
Files 76 76
Lines 5980 6002 +22
=====================================
+ Hits 4661 4684 +23
+ Misses 1319 1318 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
jerbly
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have a changelog entry. Otherwise LGTM.
lquerel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a minor suggestion, otherwise LGTM. Thanks
No description provided.