diff --git a/CHANGELOG.md b/CHANGELOG.md index 638ede1..1164365 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ * [#185](https://github.com/rubocop-hq/rubocop-performance/issues/185): Fix incorrect replacement recommendation for `Performance/ChainArrayAllocation`. ([@fatkodima][]) +### Changes + +* [#197](https://github.com/rubocop-hq/rubocop-performance/issues/197): Disable `Performance/ArraySemiInfiniteRangeSlice` cop. ([@tejasbubane][]) + ## 1.9.0 (2020-11-17) ### New features diff --git a/config/default.yml b/config/default.yml index 547c610..dfb20d6 100644 --- a/config/default.yml +++ b/config/default.yml @@ -9,7 +9,11 @@ Performance/AncestorsInclude: Performance/ArraySemiInfiniteRangeSlice: Description: 'Identifies places where slicing arrays with semi-infinite ranges can be replaced by `Array#take` and `Array#drop`.' - Enabled: pending + # This cop was created due to a mistake in microbenchmark. + # Refer https://github.com/rubocop-hq/rubocop-performance/pull/175#issuecomment-731892717 + Enabled: false + # Unsafe for string slices because strings do not have `#take` and `#drop` methods. + Safe: false VersionAdded: '1.9' Performance/BigDecimalWithNumericArgument: diff --git a/docs/modules/ROOT/pages/cops_performance.adoc b/docs/modules/ROOT/pages/cops_performance.adoc index 499c3d2..407211b 100644 --- a/docs/modules/ROOT/pages/cops_performance.adoc +++ b/docs/modules/ROOT/pages/cops_performance.adoc @@ -37,15 +37,18 @@ NOTE: Required Ruby version: 2.7 |=== | Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged -| Pending -| Yes -| Yes +| Disabled +| No +| Yes (Unsafe) | 1.9 | - |=== This cop identifies places where slicing arrays with semi-infinite ranges can be replaced by `Array#take` and `Array#drop`. +This cop was created due to a mistake in microbenchmark and hence is disabled by default. +Refer https://github.com/rubocop-hq/rubocop-performance/pull/175#issuecomment-731892717 +This cop is also unsafe for string slices because strings do not have `#take` and `#drop` methods. === Examples diff --git a/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb b/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb index dffe677..61250a3 100644 --- a/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb +++ b/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb @@ -5,6 +5,9 @@ module Cop module Performance # This cop identifies places where slicing arrays with semi-infinite ranges # can be replaced by `Array#take` and `Array#drop`. + # This cop was created due to a mistake in microbenchmark and hence is disabled by default. + # Refer https://github.com/rubocop-hq/rubocop-performance/pull/175#issuecomment-731892717 + # This cop is also unsafe for string slices because strings do not have `#take` and `#drop` methods. # # @example # # bad