Skip to content

Commit

Permalink
[Fix #197] Disable Performance/ArraySemiInfiniteRangeSlice cop
Browse files Browse the repository at this point in the history
This cop was created due to a mistake in microbenchmark
Refer rubocop/rubocop-performance#175 (comment)

Closes #197, #198
  • Loading branch information
richardstewart0213 committed Nov 24, 2020
1 parent 33dca8e commit a9c60fc
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion config/default.yml
Expand Up @@ -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:
Expand Down
9 changes: 6 additions & 3 deletions docs/modules/ROOT/pages/cops_performance.adoc
Expand Up @@ -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

Expand Down
Expand Up @@ -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
Expand Down

0 comments on commit a9c60fc

Please sign in to comment.