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
Here, save's return value is checked, there should not be complains about it.
$ cat /tmp/save.rb
def foo
@user = User.find(params[:id])
if(@user.save)
puts 'ok'
else
puts 'ko'
end
end
Actual behavior
$ bundle exec rubocop --only Rails/SaveBang /tmp/save.rb
Inspecting 1 file
Offenses:
/tmp/save.rb:3:14: C: [Correctable] Rails/SaveBang: Use save! instead of save if the return value is not checked.
if(@user.save)
^^^^
1 file inspected, 1 offense detected, 1 offense autocorrectable
Steps to reproduce the problem
The problem is the parens. I wholeheartedly agree that they are not just superfluous, they are undesirable. Yet this piece of code is valid, and the parens should be ignored.
Hi guys!
Expected behavior
Here,
save
's return value is checked, there should not be complains about it.Actual behavior
Steps to reproduce the problem
The problem is the parens. I wholeheartedly agree that they are not just superfluous, they are undesirable. Yet this piece of code is valid, and the parens should be ignored.
RuboCop version
The text was updated successfully, but these errors were encountered: