From c733db0cc390441b60d6db7452af50cbc8dff17a Mon Sep 17 00:00:00 2001 From: Laust Rud Jacobsen Date: Mon, 12 Oct 2015 21:58:07 +0200 Subject: [PATCH] Rubocop: fix unnecessary parallel assignment --- .rubocop_todo.yml | 7 ------- app/models/problem.rb | 3 ++- spec/models/app_spec.rb | 4 ++-- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index b1cf35f..2f6f723 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -335,13 +335,6 @@ Style/MultilineBlockLayout: Style/MultilineOperationIndentation: Enabled: false -# Offense count: 2 -# Cop supports --auto-correct. -Style/ParallelAssignment: - Exclude: - - 'app/models/problem.rb' - - 'spec/models/app_spec.rb' - # Offense count: 5 # Cop supports --auto-correct. # Configuration parameters: PreferredDelimiters. diff --git a/app/models/problem.rb b/app/models/problem.rb index ca4d49a..2d9533c 100644 --- a/app/models/problem.rb +++ b/app/models/problem.rb @@ -249,7 +249,8 @@ class Problem private def attribute_count_descrease(name, value) - counter, index = send(name), attribute_index(value) + counter = send(name) + index = attribute_index(value) if counter[index] && counter[index]['count'] > 1 counter[index]['count'] -= 1 else diff --git a/spec/models/app_spec.rb b/spec/models/app_spec.rb index b0a0291..bf61ad7 100644 --- a/spec/models/app_spec.rb +++ b/spec/models/app_spec.rb @@ -152,8 +152,8 @@ describe App, type: 'model' do context "copying attributes from existing app" do it "should only copy the necessary fields" do - @app, @copy_app = Fabricate(:app, :name => "app", :github_repo => "url"), - Fabricate(:app, :name => "copy_app", :github_repo => "copy url") + @app = Fabricate(:app, :name => "app", :github_repo => "url") + @copy_app = Fabricate(:app, :name => "copy_app", :github_repo => "copy url") @copy_watcher = Fabricate(:watcher, :email => "copywatcher@example.com", :app => @copy_app) @app.copy_attributes_from(@copy_app.id) expect(@app.name).to eq "app" -- libgit2 0.21.2