You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I noticed autocorrecting some of our older code that the suggested code by RuboCop is actually totally unnecessary and it seems like a place where codebases could be simplified.
Our original code was:
nextunlessattrs && attrs.respond_to?(:[])
RuboCop suggested:
nextunlessattrs&.respond_to?(:[])
There's really no need for the &. safe navigation though because even nil has respond_to?. This can just be autocorrected to:
nextunlessattrs.respond_to?(:[])
Describe the solution you'd like
A new cop to remove unnecessary safe navigation
Describe alternatives you've considered
🤷
Additional context
🚫
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
I noticed autocorrecting some of our older code that the suggested code by RuboCop is actually totally unnecessary and it seems like a place where codebases could be simplified.
Our original code was:
RuboCop suggested:
There's really no need for the &. safe navigation though because even nil has respond_to?. This can just be autocorrected to:
Describe the solution you'd like
A new cop to remove unnecessary safe navigation
Describe alternatives you've considered
🤷
Additional context
🚫
The text was updated successfully, but these errors were encountered: