Pattern: Use of arr[0]
/arr[-1]
Issue: -
Identifies usages of arr[0]
and arr[-1]
and suggests to change them to use arr.first
and arr.instead
.
# bad
arr[0]
arr[-1]
# good
arr.first
arr.last
arr[0] = 2
arr[0][-2]
Pattern: Use of arr[0]
/arr[-1]
Issue: -
Identifies usages of arr[0]
and arr[-1]
and suggests to change them to use arr.first
and arr.instead
.
# bad
arr[0]
arr[-1]
# good
arr.first
arr.last
arr[0] = 2
arr[0][-2]