26 Dec 23
RubyPigeon’s frustration with RuboCop:
The problem starts when it is viewed not as a tool, but as a set of divine commandments. Thou shalt not make implicit nils explicit. Thou shalt not write long-form conditionals. Thus saith the RuboCop.
I can often get frustrated with linters and was looking for an anti-RuboCop rant I could get behind but in this case I thought RuboCop was spot on and that RuboCop’s version is better than RubyPigeon’s. 🤷🏻♀️
When things are overly-explicated it looks to me like there’s something wrong or that something is missing there. A guard clause style formatting is appropriate here; you’re subclassing HTMLFilter just to add a guard clause to its render_element method. RuboCop gets that point straight forwardly & immediately across. Super if safe?. Otherwise don’t. Period. In Helvetica. Any questions? Of course not.