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:
divyanshumehta committed 2017-06-14 09:22:19 +05:30
1 parent be72b9d02e
commit cdf794ecbf
5 files changed
+7 -13

No files matched your search

@@ -7,9 +7,7 @@ class GenerateUsername < ActiveRecord::Migration
TempUser.all.each do |user|
if user.username.blank?
username = user.email.split('@')[0]
if TempUser.find_by(username: username)
username = username + user.id.to_s
end
username += user.id.to_s if TempUser.find_by(username: username)
user.update_attributes(username: username)
end
end