mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Add Style/SelfAssignment Rubocop cop
The cop enforces use of self assignment operator E.g. a=a+2 gets written as a+=2. Also the offenses listed in rubocop.todo.yml have been corrected automatically with the --auto-correct option. Fixes issue #1531
This commit is contained in:
parent
be72b9d02e
commit
cdf794ecbf
5 changed files with 7 additions and 13 deletions
|
|
@ -115,7 +115,7 @@ class Event < ActiveRecord::Base
|
|||
def average_rating
|
||||
@total_rating = 0
|
||||
votes.each do |vote|
|
||||
@total_rating = @total_rating + vote.rating
|
||||
@total_rating += vote.rating
|
||||
end
|
||||
@total = votes.size
|
||||
@total_rating > 0 ? number_with_precision(@total_rating / @total.to_f, precision: 2, strip_insignificant_zeros: true) : 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue