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 #175 (comment)

Closes #197, #198
  • Loading branch information
tejasbubane committed Nov 24, 2020
1 parent d460877 commit 8a9eaa4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
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/pull/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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 8a9eaa4

Please sign in to comment.