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
The Rails/SaveBang Cop is smart enough to know when the return value is being used in a conditional, except for when you are checking the inverse with a bang prefix. Then it raises an offense.
Expected behavior
Ignore when the return value is used in a conditional, for both normal and inverse.
i.e. I would it expect neither of the following to raise an offense.
normal ✅
if@user.update_attributes(params[:user])
inverse ✅
if !@user.update_attributes(params[:user])
Actual behavior
Normal works fine but inverse does not.
normal ✅
if@user.update_attributes(params[:user])
This raises an offense:
inverse ❌
if !@user.update_attributes(params[:user])
Steps to reproduce the problem
See above.
RuboCop version
Include the output of rubocop -V. Here's an example:
The Rails/SaveBang Cop is smart enough to know when the return value is being used in a conditional, except for when you are checking the inverse with a bang prefix. Then it raises an offense.
Expected behavior
Ignore when the return value is used in a conditional, for both normal and inverse.
i.e. I would it expect neither of the following to raise an offense.
normal ✅
inverse ✅
Actual behavior
Normal works fine but inverse does not.
normal ✅
This raises an offense:
inverse ❌
Steps to reproduce the problem
See above.
RuboCop version
Include the output of
rubocop -V
. Here's an example:$ bundle exec rubocop -V 0.55.0 (using Parser 2.5.1.0, running on ruby 2.3.6 x86_64-darwin17)
The text was updated successfully, but these errors were encountered: