You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Kind of like Style/UnusedMethodArgument but targeted specifically at &block arguments and autofixes them by removing them from the method signature.
When fixing this:
deffoo(&block)block.callend
It gets fixed to this via Performance/RedundantBlockCall and Style/UnusedMethodArgument:
deffoo(&_block)yieldend
That is still slow, and i think rubocop should be able to autocorrect that further to:
deffooyieldend
Don't know if that's additional functionality to one of those two cops, or if its a third cop to add.
I pretty sure its safe to do this since ruby always accepts a block even if its not declared on the method signature, so its totally useless to have it there if its never called?
The text was updated successfully, but these errors were encountered:
I work with some people that like to leave &block In the signature for documentation purposes. I prefer removing it, I'm just letting you know about that point of view.
its totally useless to have it there if its never called?
I agree that the argument should be removed for performance. If somebody doesn't like it, they'll need to disable a cop, just like any other time people disagree with rubocop.
Yeah, I'm considering it to be 'useless' from ruby's perspective -- IOW, the code won't break if its programmatically removed from a large codebase and there's no odd unintended side effects from the ruby interpreter that I've not considered.
Kind of like Style/UnusedMethodArgument but targeted specifically at &block arguments and autofixes them by removing them from the method signature.
When fixing this:
It gets fixed to this via Performance/RedundantBlockCall and Style/UnusedMethodArgument:
That is still slow, and i think rubocop should be able to autocorrect that further to:
Don't know if that's additional functionality to one of those two cops, or if its a third cop to add.
I pretty sure its safe to do this since ruby always accepts a block even if its not declared on the method signature, so its totally useless to have it there if its never called?
The text was updated successfully, but these errors were encountered: