Commit c733db0cc390441b60d6db7452af50cbc8dff17a
1 parent
4b670105
Exists in
master
and in
1 other branch
Rubocop: fix unnecessary parallel assignment
Showing
3 changed files
with
4 additions
and
10 deletions
Show diff stats
.rubocop_todo.yml
... | ... | @@ -335,13 +335,6 @@ Style/MultilineBlockLayout: |
335 | 335 | Style/MultilineOperationIndentation: |
336 | 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 | 338 | # Offense count: 5 |
346 | 339 | # Cop supports --auto-correct. |
347 | 340 | # Configuration parameters: PreferredDelimiters. | ... | ... |
app/models/problem.rb
... | ... | @@ -249,7 +249,8 @@ class Problem |
249 | 249 | private |
250 | 250 | |
251 | 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 | 254 | if counter[index] && counter[index]['count'] > 1 |
254 | 255 | counter[index]['count'] -= 1 |
255 | 256 | else | ... | ... |
spec/models/app_spec.rb
... | ... | @@ -152,8 +152,8 @@ describe App, type: 'model' do |
152 | 152 | |
153 | 153 | context "copying attributes from existing app" do |
154 | 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 | 157 | @copy_watcher = Fabricate(:watcher, :email => "copywatcher@example.com", :app => @copy_app) |
158 | 158 | @app.copy_attributes_from(@copy_app.id) |
159 | 159 | expect(@app.name).to eq "app" | ... | ... |