Ruby

Ruby

Made by DeepSource

Double start_with?/end_with? can be combined RB-PR1008

Performance
Major
Autofix

Double #start_with? or #end_with? calls separated by ||, in some cases, can be replaced with an single #start_with?/#end_with? call.

Bad practice

str.start_with?("a") || str.start_with?(Some::CONST)
str.start_with?("a", "b") || str.start_with?("c")
str.end_with?(var1) || str.end_with?(var2)

Recommended

str.start_with?("a", Some::CONST)
str.start_with?("a", "b", "c")
str.end_with?(var1, var2)