Don’t use safe navigation operator unless nil is expected

Don’t use the safe navigation (“lonely”) operator to paper over an unexpected nil. This is not the root cause of the bug and while doing so may suppress it, it’s only going to make things harder to understand.

The safe navigation operator is appropriate, however, when the receiver could legitimately be nil.

Bad 🔗

foo.bar # => raises NoMethodError. "OH NO! better do this..."
-foo.bar
+foo&.bar

Good 🔗

foo.bar if foo.present? # => "hmm this is a little redundant, let's do this..."
-foo.bar if foo.present?
+foo&.bar