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
Running rubocop (0.65.0) on this code 'with the --safe-auto-correct option) break it :
user = User.where(email: email).first
if user
user.notifications.create(
title: 'abc'
)
end
Result in :
next unless useruser&.notifications&.create(
title: 'abc'
)
Cops applied : "Style/Next" then "Style/SafeNavigation"
Code is broken by the "useruser" new variable, like both cops where applied on the same original code.
But, if i run those cops one after the other with the "--only" option, i got this result :
next unless user
user.notifications.create(
title: 'abc'
)
No code broken, and "Style/SafeNavigation" become unnecessary.
Best regards
The text was updated successfully, but these errors were encountered:
Hello,
Running rubocop (0.65.0) on this code 'with the --safe-auto-correct option) break it :
Result in :
Cops applied : "Style/Next" then "Style/SafeNavigation"
Code is broken by the "useruser" new variable, like both cops where applied on the same original code.
But, if i run those cops one after the other with the "--only" option, i got this result :
No code broken, and "Style/SafeNavigation" become unnecessary.
Best regards
The text was updated successfully, but these errors were encountered: