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
During work to enable Lint/UselessAssignment. Rubocop found that invoices was an unused variable. I ran be rubocop path.rb --only Lint/UselessAssignment -A and it replaced the code with the following code. which is fine. Lint/UselessAssignment is unsafe autocorrect so I ran it with -A.
When I lint this code I get errors from Lint/Void. Running autofix safe version (-a) rubocop removed the array definition, so my two invoices are not created any more.
user=FactoryBot.create(:user)
Expected behavior
My suggestion is to don't modify the array if it has anything which could have side effect
In spec we had the following code
During work to enable Lint/UselessAssignment. Rubocop found that invoices was an unused variable. I ran
be rubocop path.rb --only Lint/UselessAssignment -A
and it replaced the code with the following code. which is fine. Lint/UselessAssignment is unsafe autocorrect so I ran it with -A.When I lint this code I get errors from Lint/Void. Running autofix safe version (-a) rubocop removed the array definition, so my two invoices are not created any more.
Expected behavior
My suggestion is to don't modify the array if it has anything which could have side effect
Actual behavior
Removes by factory bot calls
Steps to reproduce the problem
Explained above
RuboCop version
The text was updated successfully, but these errors were encountered: