Commit c733db0cc390441b60d6db7452af50cbc8dff17a

Authored by Laust Rud Jacobsen
1 parent 4b670105
Exists in master and in 1 other branch production

Rubocop: fix unnecessary parallel assignment

.rubocop_todo.yml
@@ -335,13 +335,6 @@ Style/MultilineBlockLayout: @@ -335,13 +335,6 @@ Style/MultilineBlockLayout:
335 Style/MultilineOperationIndentation: 335 Style/MultilineOperationIndentation:
336 Enabled: false 336 Enabled: false
337 337
338 -# Offense count: 2  
339 -# Cop supports --auto-correct.  
340 -Style/ParallelAssignment:  
341 - Exclude:  
342 - - 'app/models/problem.rb'  
343 - - 'spec/models/app_spec.rb'  
344 -  
345 # Offense count: 5 338 # Offense count: 5
346 # Cop supports --auto-correct. 339 # Cop supports --auto-correct.
347 # Configuration parameters: PreferredDelimiters. 340 # Configuration parameters: PreferredDelimiters.
app/models/problem.rb
@@ -249,7 +249,8 @@ class Problem @@ -249,7 +249,8 @@ class Problem
249 private 249 private
250 250
251 def attribute_count_descrease(name, value) 251 def attribute_count_descrease(name, value)
252 - counter, index = send(name), attribute_index(value) 252 + counter = send(name)
  253 + index = attribute_index(value)
253 if counter[index] && counter[index]['count'] > 1 254 if counter[index] && counter[index]['count'] > 1
254 counter[index]['count'] -= 1 255 counter[index]['count'] -= 1
255 else 256 else
spec/models/app_spec.rb
@@ -152,8 +152,8 @@ describe App, type: 'model' do @@ -152,8 +152,8 @@ describe App, type: 'model' do
152 152
153 context "copying attributes from existing app" do 153 context "copying attributes from existing app" do
154 it "should only copy the necessary fields" do 154 it "should only copy the necessary fields" do
155 - @app, @copy_app = Fabricate(:app, :name => "app", :github_repo => "url"),  
156 - Fabricate(:app, :name => "copy_app", :github_repo => "copy url") 155 + @app = Fabricate(:app, :name => "app", :github_repo => "url")
  156 + @copy_app = Fabricate(:app, :name => "copy_app", :github_repo => "copy url")
157 @copy_watcher = Fabricate(:watcher, :email => "copywatcher@example.com", :app => @copy_app) 157 @copy_watcher = Fabricate(:watcher, :email => "copywatcher@example.com", :app => @copy_app)
158 @app.copy_attributes_from(@copy_app.id) 158 @app.copy_attributes_from(@copy_app.id)
159 expect(@app.name).to eq "app" 159 expect(@app.name).to eq "app"