Skip to content

Commit

Permalink
[Fix #197] Mark Performance/ArraySemiInfiniteRangeSlice cop as unsafe
Browse files Browse the repository at this point in the history
This cop is unsafe for string slices because string does not have `#take` and `#drop` methods

Closes #197
  • Loading branch information
tejasbubane committed Nov 23, 2020
1 parent fd9e060 commit f2ddd5b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## master (unreleased)

### Changes

* [#197](https://github.com/rubocop-hq/rubocop-performance/pull/197): Mark `Performance/ArraySemiInfiniteRangeSlice` cop as unsafe. ([@tejasbubane][])

## 1.9.0 (2020-11-17)

### New features
Expand Down
2 changes: 2 additions & 0 deletions config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ 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
# Unsafe for string slices because string does not have `#take` and `#drop` methods
Safe: false
VersionAdded: '1.9'

Performance/BigDecimalWithNumericArgument:
Expand Down
4 changes: 2 additions & 2 deletions docs/modules/ROOT/pages/cops_performance.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ NOTE: Required Ruby version: 2.7
| Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged

| Pending
| Yes
| Yes
| No
| Yes (Unsafe)
| 1.9
| -
|===
Expand Down

0 comments on commit f2ddd5b

Please sign in to comment.