I am cleaning up some code that I've inherited and there's this line but to be honest, I'm not sure what rubocop is trying to tell me is wrong with it.
total_cost = tmp_totals.inject { |total, tmp_val| total + tmp_val }
I am getting this error
app/models/item_count.rb:58:40: C: Name inject block params |acc, elem|
that looks like this:
I am just trying to get past this cop. Any ideas what it is telling me to fix?
By default Rubocop wants you to name those two variables
acc
andelem
instead oftotal
andtmp_val
. You can configure the variables it wants in your own rubycop.yml. The defaults are setup like this: