-
Notifications
You must be signed in to change notification settings - Fork 316
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
Add a handlebars linter to check for undefined variables in hooks #1779
Comments
This behaviour is coming from our handlebars renderer. Undefined variables don't result in rendering errors in handlebars, so they're happily rendered in our configuration and hook files as well. We could fork the handlebars renderer or add our own, but the behaviour of the I think I'd rather have the application fail instead of the renderer. @habitat-sh/habitat-core-maintainers what do you guys think? |
I'm in agreement with @reset for another reason: TOML doesn't have I would prefer if it worked like the original suggestion, but it seems we would be fighting against the underlying technologies for a small benefit. |
As as noted, we're using a handlebars rendering library and having it check for empty references would be a major change to the library. We could probably address this in a linting tool that could inspect the template, the required pkg_binds, and the default toml and look for any undefined references in the config templates. |
Recently had a conversation with @adamhjk about linting templates. Having a linter would have the nice side effect of catching errors around changing syntax at build time instead of at runtime (which in a recent case at $job would have saved me a few days of frustration). |
I vote the name of the linter be |
There is a strict mode in the handlebars library we're using. However, it was added in version 0.32.0 and we are currently stuck on version 0.28.3 for fun reasons However, @mwrock is currently doing work to extract the core templating logic from the Supervisor into the core crate. I think that work will begin to allow us to move forward with updating our handlebars dependency, and will also make it easier to provide an external linter. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We value your input and contribution. Please leave a comment if this issue still affects you. |
any thoughts...? I think this is important...
…On Thu, Apr 2, 2020 at 7:11 PM stale[bot] ***@***.***> wrote:
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. We value
your input and contribution. Please leave a comment if this issue still
affects you.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1779 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADSBHCP3JJTWSEJWZRKHM73RKUZSTANCNFSM4DAMC2IA>
.
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We value your input and contribution. Please leave a comment if this issue still affects you. |
This issue has been automatically closed after being stale for 400 days. We still value your input and contribution. Please re-open the issue if desired and leave a comment with details. |
How to reproduce
hooks/run
to contain:Expected output
error message
Actual output
Silent error; this variable is rendered as an empty string.
The text was updated successfully, but these errors were encountered: