-
Notifications
You must be signed in to change notification settings - Fork 900
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
Use erubi instead of erubis, upgrade haml/haml_lint #18868
Conversation
Fixes deprecation: ``` DEPRECATION WARNING: ActionView::Template::Handlers::Erubis is deprecated and will be removed from Rails 5.2. Switch to ActionView::Template::Handlers::ERB::Erubi instead. (called from <top (required)> at /Users/joerafaniello/Code/manageiq/config/application.rb:31) ``` Rails changed their default templating engine from erubis to erubi and started deprecating it in 5.1: rails/rails#27757 Even though we're only using erubis in WinRM, which is outside of actionview, we're getting the deprecation because: 1) We require hamlit in our Gemfile 2) It requires haml 3) It loads the haml railtie 4) Which loads the erubis template: https://github.com/haml/haml/blob/4.0.7/lib/haml/railtie.rb#L21 5) Which autoloads the deprecated constant: https://github.com/haml/haml/blob/4.0.7/lib/haml/helpers/safe_erubis_template.rb#L3 Haml 5.0.0 fixes this loading of the deprecated constant: haml/haml#895
Extracted from #18076 |
@himdel do you know how to verify this on master? It's needed for rails 5.1 but I'd like to get this in since it should be compatible with 5.0. |
Checked commit jrafanie@2c50725 with ruby 2.3.3, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0 Gemfile
|
@jrafanie Do these dependencies belong in manageiq-ui-classic? |
Honestly, I don't remember why haml-lint/hamlit were dependencies here. Maybe @himdel @mzazrivec @skateman know? Maybe we had some rake task here that was moved to ui-classic and those dependencies can now move? 🙏 Note, at one time, we were choosing to use hamlit over haml, it's unclear why it's loading haml from hamlit unless hamlit just replaces/wraps some parts of haml but still depends on it. 🤷♂ |
@jrafanie hamlit used to be faster than haml, I think it's okay to move the stuff to the ui-classic repo. |
It used to be faster? As in it's no longer true? |
@mzazrivec according to their latest benchmarks, it still is. The parser is the same though. |
OK. Anyway, we don't need these 3 gems in core, do we? |
@mzazrivec well, I'm not sure about |
If this is switching us back to haml, we will have problems. haml and hamlit are not compatible, they treat |
It's been a few months since I worked on this. Let me double check my logic in the description. I don't see how haml was being required in the first place. I don't know how much of haml was being used and where but it was definitely loading the haml railtie which led to the deprecation warning. Maybe only in test or dev mode? Let me clarify and update this. |
So, the problem is Since haml_lint doesn't have a version that forces haml >= 5.0 (where this is fixed), we have to either:
@mzazrivec @skateman @himdel I was trying to get rid of this warning before rails 5.1 lands in master and everyone sees this and wastes time looking at it. My point is even if we're not using haml in dev, it is being required... so we should verify the assertion that we are indeed using hamlit and not haml. Let me know what you'd like to do. |
I'm okay with getting rid of all the linters from the repo, we can just move them to our |
This is the correct answer 😆 PLEASE! |
Sorry for the lag...
Yup, the difference between haml and hamlit is essentially this:
vs
.. so, -haml
+hamlit
-<div foo quux=''>
+<div bar='false' baz='' foo='true' quux=''> Adding such a thing in |
Heh heh, that's the reason issue #1 is still open :). Theoretically we should not be needing haml or hamlit in core. (And I agree with @skateman that we don't really use the linters in a task or on travis, so they can go.) |
So... idk.. I'm fine with this as is, |
Followup to ManageIQ#18868 This a development dependency that can be added individually for anyone who needs it. The problem is `hamlit` tries to require `haml` in the template [here](https://github.com/k0kubun/hamlit/blob/94b14839cd42e8b70715ba7c0caf18c2c47ec67a/lib/hamlit/template.rb#L8) and because we have `haml` in our dependency tree due to `haml_lint` (for dev), it will be able to require it. Because this causes the rails 5.1 deprecated constant to be loaded, we get this deprecation warning: ``` DEPRECATION WARNING: ActionView::Template::Handlers::Erubis is deprecated and will be removed from Rails 5.2. Switch to ActionView::Template::Handlers::ERB::Erubi instead. (called from <top (required)> at /Users/joerafaniello/Code/manageiq/config/application.rb:31) ``` Since haml_lint doesn't have a version that forces haml >= 5.0 (where this is fixed), we have to either: * add haml it as a direct dependency so we can say >= 5.0 (like this PR) * drop haml_lint entirely (so haml doesn't get in the dependency tree) * ignore/live with this warning whenever you run tests or rails server/console/etc. This commit takes option 2, drop haml_lint since it's a dev dependency that can easily be added in bundler.d directory for any developers who want it.
Followup to ManageIQ#18868 This a development dependency that can be added individually for anyone who needs it. The problem is `hamlit` tries to require `haml` in the template [here](https://github.com/k0kubun/hamlit/blob/94b14839cd42e8b70715ba7c0caf18c2c47ec67a/lib/hamlit/template.rb#L8) and because we have `haml` in our dependency tree due to `haml_lint` (for dev), it will be able to require it. Because this causes the rails 5.1 deprecated constant to be loaded, we get this deprecation warning: ``` DEPRECATION WARNING: ActionView::Template::Handlers::Erubis is deprecated and will be removed from Rails 5.2. Switch to ActionView::Template::Handlers::ERB::Erubi instead. (called from <top (required)> at /Users/joerafaniello/Code/manageiq/config/application.rb:31) ``` Since haml_lint doesn't have a version that forces haml >= 5.0 (where this is fixed), we have to either: * add haml it as a direct dependency so we can say >= 5.0 (like this PR) * drop haml_lint entirely (so haml doesn't get in the dependency tree) * ignore/live with this warning whenever you run tests or rails server/console/etc. This commit takes option 2, drop haml_lint since it's a dev dependency that can easily be added in bundler.d directory for any developers who want it.
Ok, I opened #18886 after confirming that dropping just haml_lint fixes this warning. Thanks all! |
Fixes deprecation:
Rails changed their default templating engine from erubis to erubi and
started deprecating it in 5.1:
rails/rails#27757
Even though we're only using erubis in WinRM, which is outside of
actionview, we're getting the deprecation because:
https://github.com/haml/haml/blob/4.0.7/lib/haml/railtie.rb#L21
https://github.com/haml/haml/blob/4.0.7/lib/haml/helpers/safe_erubis_template.rb#L3
Haml 5.0.0 fixes this loading of the deprecated constant:
haml/haml#895