Layout/RescueEnsureAlignment cop requires illegible alignment in blocks
Currently the Layout/RescueEnsureAlignment cop flags an error on this, which I would consider the standard formatting:
@threads << Thread.new do
yield
ensure
ActiveRecord::Base.clear_active_connections!
end
It wants it to look like this:
@threads << Thread.new do
yield
ensure
ActiveRecord::Base.clear_active_connections!
end
I think this is a misconfiguration based on alignment to begin. As the begin is optional inside blocks and method definitions, the first example should be correct, as the version with a begin would look like this:
@threads << Thread.new do
begin
yield
ensure
ActiveRecord::Base.clear_active_connections!
end
Inside blocks and method definitions this rule should most likely align the rescue/ensure calls to the end rather than the starting call, as with begin (for which I would say this rule is correct).
Edited by 🤖 GitLab Bot 🤖