Programming Search⌘K

Ruby lints, page 5 of 6

The lint rules of Ruby, with what each one finds. This page has 1,016 cards.

Use negative array indices instead of calculating array length minus a value. Also handles range patterns with length calculations. Recognizes preserving methods and their combinations, allowing safe replacement when the receiver matches. Style/NegativeArrayIndex

It is a pending cop, so RuboCop enables it only when the configuration turns on new cops. It was added in RuboCop 1.84. It is not safe, so it can report false positives.

Code
Style/NegativeArrayIndex

Source: github.com, docs.rubocop.org. JSON record. This entry is a card. Help write this page.