You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
…iteRangeSlice`
Fixesrubocop#365.
This PR fixes false positives for `Performance/ArraySemiInfiniteRangeSlice`
when using `[]` with string literals.
What this can do is accept string literals, as they are already marked as unsafe.
Expected behavior
Based on the cop name, it shouldn't detect instances where the method
[]
with a semi-infinite range is called on Strings.Actual behavior
Which autocorrects
"string"[3..]
tostring.drop(3)
, which causesundefined method 'drop' for String (NoMethodError)
Steps to reproduce the problem
Use
[]
with a semi-infinite range on a string, e.g."string"[3..]
RuboCop version
The text was updated successfully, but these errors were encountered: