Shopify / rubocop-sorbet

A collection of RuboCop rules for Sorbet
MIT License
182 stars 27 forks source link

Patch `Performance/RedundantBlockCall` to teach it about Sorbet `sig`s #200

Open sambostock opened 8 months ago

sambostock commented 8 months ago

We disable Performance/RedundantBlockCall because "[it] conflicts with Sorbet since we need to capture the block to type it."

There is precedent for RuboCop extensions patching cops defined somewhere else, and this seems like a reasonable thing to patch. If the method definition is prefixed with a sig, this cop should not complain about capturing the block argument, even if yield is used.

sambostock commented 8 months ago

Another option would be to teach the cop about Sorbet upstream in rubocop-performance, but that is likely to be rejected.