It would be nice to have a cop that enforces consistent usage of empty lines after early returns.
Example:
def on_block(node)
return unless style == :method_call
add_offense(node) if expect_change_with_block?(node)
end
Here the cop would require adding a blank line after the return.
Note: it's possible tho have multiple consecutive return statements with different conditions. In that case I would suggest adding the blank line after the last return.
Yeah, that makes perfect sense to me. It's an extremely common style of coding, practiced by myself as well.
I have had this on my list for a while, but I imagine an EmptyLinesAroundGuardClause, which would cover things like next as well. 馃檪
Most helpful comment
Yeah, that makes perfect sense to me. It's an extremely common style of coding, practiced by myself as well.