seattlerb / debride

Analyze code for potentially uncalled / dead methods, now with auto-removal.
https://www.zenspider.com/projects/debride.html
720 stars 19 forks source link

Ruby in HAML templates not recognized #4

Closed ianlotinsky closed 9 years ago

ianlotinsky commented 9 years ago

Ruby in HAML templates are not recognized. For example, some_method would not be recognized in some_template.html.haml:

- if some_method
zenspider commented 9 years ago

Correct. haml isn't ruby so it doesn't even try. I'd be open to a plugin system that allowed it to do the haml->ruby conversion first. Look at flay for an example of how that could work. It has an erb plugin.

ianlotinsky commented 9 years ago

Thanks for being open to this option. It doesn't look like HAML has a simple conversion method like ERB.src. Would you be open to a patch for a plugin that would strip HAML syntax and then process the Ruby that remains?

zenspider commented 9 years ago

No, because that won't necessarily be valid.

Last time I looked, Haml::Engine.new(haml).precompiled would work. If that's changed, there's got to be some other equivalent. It's necessary for haml to do its thing.

ianlotinsky commented 9 years ago

Ah, good find. I personally avoid HAML so I'm not as familiar with it.

On Mar 17, 2015, at 8:36 PM, Ryan Davis notifications@github.com wrote:

No, because that won't necessarily be valid.

Last time I looked, Haml::Engine.new(haml).precompiled would work. If that's changed, there's got to be some other equivalent. It's necessary for haml to do its thing.

— Reply to this email directly or view it on GitHub.

zenspider commented 9 years ago

I'm releasing debride 1.2.0 now. It includes a plugin system that allows for multiple file types to be processed by debride. I'll be releasing debride-erb shortly thereafter. It should be trivial to copy that and add haml support.

ianlotinsky commented 9 years ago

Awesome. I'm looking forward to it and would be happy to author the HAML plugin.