Skip to content

Add Rubocop cop for `return if variable&.empty?`

Description

return if variable&.empty? is probably not something that an author wants, because it is not going to work in case of variable being nil.

Proposal

Cop can suggest writing return if variable.to_a / to_h.empty? or return unless variable.present?

/cc @rspeicher