diff --git a/changelog/change_disable_block_given.md b/changelog/change_disable_block_given.md new file mode 100644 index 000000000..535858d8c --- /dev/null +++ b/changelog/change_disable_block_given.md @@ -0,0 +1 @@ +* [#385](https://github.com/rubocop/rubocop-performance/issues/385): Disable `Performance/BlockGivenWithExplicitBlock` by default. ([@earlopain][]) diff --git a/config/default.yml b/config/default.yml index 95dc83089..cf44ddf5e 100644 --- a/config/default.yml +++ b/config/default.yml @@ -32,8 +32,11 @@ Performance/BindCall: Performance/BlockGivenWithExplicitBlock: Description: 'Check block argument explicitly instead of using `block_given?`.' - Enabled: pending + # This cop was created due to a mistake in microbenchmark. + # https://github.com/rubocop/rubocop-performance/issues/385 + Enabled: false VersionAdded: '1.9' + VersionChanged: <> Performance/Caller: Description: >- diff --git a/lib/rubocop/cop/performance/block_given_with_explicit_block.rb b/lib/rubocop/cop/performance/block_given_with_explicit_block.rb index a3d804694..4fc44169e 100644 --- a/lib/rubocop/cop/performance/block_given_with_explicit_block.rb +++ b/lib/rubocop/cop/performance/block_given_with_explicit_block.rb @@ -6,6 +6,9 @@ module Performance # Identifies unnecessary use of a `block_given?` where explicit check # of block argument would suffice. # + # NOTE: This cop produces code with significantly worse performance when a + # block is being passed to the method and as such should not be enabled. + # # @example # # bad # def method(&block)