fix(template): require --file or --template flag#112
Conversation
Add validation in engine.Render to return a clear error when no template files are specified, instead of silently producing minimal output. Remove dead code branch in template.go (unreachable condition check). Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughValidation logic for template file requirements has been reorganized: a check preventing Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
📝 Coding Plan
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 Tip CodeRabbit can suggest fixes for GitHub Check annotations.Configure the |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request correctly removes a dead code branch and adds validation to ensure template files are provided. My feedback focuses on improving the new validation by suggesting to move it to fail-fast, which will improve efficiency by avoiding unnecessary operations when no templates are specified.
| if len(opts.TemplateFiles) == 0 { | ||
| return nil, fmt.Errorf("templates are not set for the command: please use `--file` or `--template` flag") | ||
| } |
There was a problem hiding this comment.
For better efficiency, this check should be at the beginning of the Render function. Placing it here means that chart loading and template rendering (loader.LoadDir, loadValues, eng.Render) are performed even when they are not needed, only to fail afterwards. Moving this check to the top of the function would allow it to fail-fast and avoid these unnecessary operations.
Summary
engine.Renderto return a clear error when no template files are specified, instead of silently producing minimal outputtemplate.go(unreachable condition check)Test plan
talm template -i -n X -e Xwithout--fileor--template— should show errortalm template -i -f nodes/file.yaml— should work as beforetalm template -t templates/controlplane.yaml— should work as beforeSummary by CodeRabbit
Bug Fixes