Hacker News new | ask | show | jobs
by brightstep 1613 days ago
I don't like either of your or rubocop's approach. If you have that many conditionals, bind a local variable that describes the condition being checked. Then you have an easy to read `if` with a single variable.
1 comments

or a model method or private method in the class containing this code
But why?!?! There's no way this conditional is a well-defined named concept and just adds indirection for the sake of line length.
>There's no way this conditional is a well-defined named concept

Sure about that? I'm saying if it is then extracting as a method might be clearer. All depends and these are other options.

maybe two well-named concepts then? If you're unable to reduce it at all, I'd consider that a code smell.