BlueStyle
BlueStyle copied to clipboard
How to wrap chained short-circuiting logic operations?
If we have code the goes over the line limit, like
if primal_name isa Symbol || Meta.isexpr(primal_name, :(.)) || Meta.isexpr(primal_name, :curly)
# do stuff
end
How should that be wrapped?
I think our preference would be for something like this
if (
primal_name isa Symbol ||
Meta.isexpr(primal_name, :(.)) ||
Meta.isexpr(primal_name, :curly)
)
# do stuff
end
does that seem right?
Yes, that seems reasonable. I'm rather flexible on this so if you're over the line limit you could still allow multiple conditions one line and wrap it where necessary. In some cases where you are mixing &&
and ||
you may want to break it up in some other logical form