We all know that mixing business logic and presentation is just plain wrong. If you don’t believe me, go have a look at a classic ASP or JSP application of yesteryear. So the prevailing opinion is that we should seek to move business logic into the back end – in MVC applications, the controller (mmm – not always ideal) or the model (perfect).
My colleague Alan and I were discussing this issue – in particular how metric_fu doesn’t inspect our view logic. We have a solution. Here’s the alpha version of our new tool, metric_view_fu. It finds logic buried in HAML view code.
egrep -cir '\- if|\- else|\- while' app/views/* | sort -n -k 2 -t ':'
I think there’s room for improvement.