Ruby

Ruby

Made by DeepSource

Case-insensitive comparison of strings can use casecmp RB-PR1003

Performance
Major
Autofix

Case-insensitive string comparison can be done more efficiently using casecmp.

Bad practice

str.downcase == 'abc'
str.upcase.eql? 'ABC'
'abc' == str.downcase
'ABC'.eql? str.upcase

Recommended

str.casecmp('ABC').zero?
'abc'.casecmp(str).zero?