Skip to content

Commit

Permalink
[ci] Fix MultilineHashBraceLayout complains
Browse files Browse the repository at this point in the history
  • Loading branch information
David Kang committed Dec 13, 2017
1 parent af15490 commit b82ddcd
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 61 deletions.
18 changes: 0 additions & 18 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,6 @@ Layout/DotPosition:
Layout/IndentHash:
Enabled: false

# Offense count: 23
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: symmetrical, new_line, same_line
Layout/MultilineHashBraceLayout:
Exclude:
- 'src/api/app/controllers/source_controller.rb'
- 'src/api/app/controllers/webui/request_controller.rb'
- 'src/api/app/models/binary_release.rb'
- 'src/api/app/models/package.rb'
- 'src/api/app/models/project.rb'
- 'src/api/lib/xpath_engine.rb'
- 'src/api/test/functional/distributions_controller_test.rb'
- 'src/api/test/functional/group_request_test.rb'
- 'src/api/test/functional/release_management_test.rb'
- 'src/api/test/functional/request_controller_test.rb'
- 'src/api/test/functional/source_controller_test.rb'

# Offense count: 66
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Expand Down
9 changes: 3 additions & 6 deletions src/api/app/controllers/source_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,7 @@ def delete_project
project.check_weak_dependencies!
opts = { no_write_to_backend: true,
force: params[:force].present?,
recursive_remove: params[:remove_linking_repositories].present?
}
recursive_remove: params[:remove_linking_repositories].present? }
check_and_remove_repositories!(project.repositories, opts)

logger.info "destroying project object #{project.name}"
Expand Down Expand Up @@ -499,8 +498,7 @@ def update_project_meta
remove_repositories = project.get_removed_repositories(request_data)
opts = { no_write_to_backend: true,
force: params[:force].present?,
recursive_remove: params[:remove_linking_repositories].present?
}
recursive_remove: params[:remove_linking_repositories].present? }
check_and_remove_repositories!(remove_repositories, opts)
end

Expand Down Expand Up @@ -1055,8 +1053,7 @@ def project_command_move
project = Project.get_by_name(params[:oproject])
commit = { login: User.current.login,
lowprio: 1,
comment: "Project move from #{params[:oproject]} to #{params[:project]}"
}
comment: "Project move from #{params[:oproject]} to #{params[:project]}" }
commit[:comment] = params[:comment] unless params[:comment].blank?
Backend::Api::Sources::Project.move(params[:oproject], params[:project])
project.name = params[:project]
Expand Down
3 changes: 1 addition & 2 deletions src/api/app/controllers/webui/request_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,7 @@ def add_role_request
req.description = params[:description]

opts = { target_project: params[:project],
role: params[:role]
}
role: params[:role] }
opts[:target_package] = params[:package] if params[:package]
opts[:person_name] = params[:user] if params[:user]
opts[:group_name] = params[:group] if params[:group]
Expand Down
3 changes: 1 addition & 2 deletions src/api/app/models/binary_release.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ def self.update_binary_releases_via_json(repository, json, time = Time.now)
binary_arch: binary["binaryarch"],
medium: binary["medium"],
obsolete_time: nil,
modify_time: nil
}
modify_time: nil }
# check for existing entry
existing = oldlist.where(hash)
Rails.logger.info "ERROR: multiple matches, cleaning up: #{existing.inspect}" if existing.count > 1
Expand Down
3 changes: 1 addition & 2 deletions src/api/app/models/package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1111,8 +1111,7 @@ def branch_from(origin_project, origin_package, rev = nil, missingok = nil, comm
noservice: "1",
oproject: origin_project,
opackage: origin_package,
user: User.current.login
}
user: User.current.login }
myparam[:orev] = rev if rev.present?
myparam[:olinkrev] = olinkrev if olinkrev.present?
myparam[:missingok] = '1' if missingok
Expand Down
4 changes: 1 addition & 3 deletions src/api/app/models/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -665,9 +665,7 @@ def store(opts = {})
# individually on backend
def cleanup_packages
packages.each do |package|
package.commit_opts = { no_backend_write: 1,
project_destroy_transaction: 1, request: commit_opts[:request]
}
package.commit_opts = { no_backend_write: 1, project_destroy_transaction: 1, request: commit_opts[:request] }
package.destroy
end
end
Expand Down
3 changes: 1 addition & 2 deletions src/api/lib/xpath_engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,7 @@ def initialize
'state/@who' => { cpart: 'bs_requests.commenter' },
'state/@when' => { cpart: 'bs_requests.updated_at' },
'action/@type' => { cpart: 'a.type',
joins: "LEFT JOIN bs_request_actions a ON a.bs_request_id = bs_requests.id"
},
joins: "LEFT JOIN bs_request_actions a ON a.bs_request_id = bs_requests.id" },
'action/grouped/@id' => { cpart: 'gr.number',
joins: ["LEFT JOIN bs_request_actions a ON a.bs_request_id = bs_requests.id",
"LEFT JOIN group_request_requests g on g.bs_request_action_group_id = a.id",
Expand Down
3 changes: 1 addition & 2 deletions src/api/test/functional/distributions_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ def test_should_show_distribution
"url" =>
"https://static.opensuse.org/distributions/logos/opensuse-Factory-16.png",
"width" => {"type" => "integer", "_content" => "16"},
"height" => {"type" => "integer", "_content" => "16"}}]}
}, Xmlhash.parse(@response.body))
"height" => {"type" => "integer", "_content" => "16"}}]}}, Xmlhash.parse(@response.body))
end

def test_should_destroy_distribution
Expand Down
15 changes: 5 additions & 10 deletions src/api/test/functional/group_request_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ def test_set_and_get
"action" => {"type" => "group", "grouped" => {"id" => "2"}},
"state" =>
{"name" => "new", "who" => "king", "when" => "2010-07-12T00:00:00", "comment" => {}},
"description" => {}
}, Xmlhash.parse(@response.body))
"description" => {}}, Xmlhash.parse(@response.body))
Timecop.freeze(1)

# try to create a cycle
Expand All @@ -70,8 +69,7 @@ def test_set_and_get
"action" => {"type" => "group", "grouped" => [{"id" => "2"}, {"id" => adi}]},
"state" =>
{"name" => "new", "who" => "king", "when" => "2010-07-12T00:00:00", "comment" => {}},
"description" => {}
}, Xmlhash.parse(@response.body))
"description" => {}}, Xmlhash.parse(@response.body))
Timecop.freeze(1)

# now one in review
Expand All @@ -87,8 +85,7 @@ def test_set_and_get
"action" => {"type" => "group", "grouped" => [{"id" => "2"}, {"id" => adi}, {"id" => withr}]},
"state" =>
{"name" => "review", "who" => "king", "when" => "2010-07-12T00:00:02", "comment" => {}},
"description" => {}
}, Xmlhash.parse(@response.body))
"description" => {}}, Xmlhash.parse(@response.body))
Timecop.freeze(1)
# group_1 should be in review too now
get "/request/#{adi}"
Expand All @@ -106,8 +103,7 @@ def test_set_and_get
"when" => "2010-07-12T00:00:02",
"comment" => {}
},
"description" => {}
}, Xmlhash.parse(@response.body))
"description" => {}}, Xmlhash.parse(@response.body))

# now we revoke the group and adi should be new again
post "/request/#{id}?cmd=changestate&newstate=revoked"
Expand Down Expand Up @@ -136,8 +132,7 @@ def test_set_and_get
"when" => "2010-07-12T00:00:03",
"description" => "Request got reopened",
"comment" => "Reopened by removing from group #{id}"}],
"description" => {}
}, Xmlhash.parse(@response.body))
"description" => {}}, Xmlhash.parse(@response.body))
end

def test_remove_request
Expand Down
9 changes: 5 additions & 4 deletions src/api/test/functional/release_management_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,7 @@ def test_copy_project_withbinaries
repository: '10.2',
arch: 'i586',
code: 'published',
state: 'published' }
},
state: 'published' }},
tag: 'status',
attributes: { package: 'TestPack',
code: 'succeeded' }
Expand All @@ -192,7 +191,8 @@ def test_copy_project_withbinaries
repository: '10.2',
arch: 'x86_64',
code: 'published',
state: 'published' } },
state: 'published' }
},
tag: 'status', attributes: { package: 'TestPack',
code: 'succeeded' }

Expand Down Expand Up @@ -229,7 +229,8 @@ def test_copy_project_withbinaries
repository: '10.2',
arch: 'i586',
code: 'published',
state: 'published' } },
state: 'published' }
},
tag: 'status',
attributes: { package: 'TestPack', code: 'succeeded' }

Expand Down
3 changes: 1 addition & 2 deletions src/api/test/functional/request_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1004,8 +1004,7 @@ def test_create_request_and_multiple_reviews
'who' => 'tom',
'when' => '2010-07-12T00:00:04',
'comment' => 'review2' }
]
}, node)
]}, node)
end

def test_assign_from_group
Expand Down
12 changes: 4 additions & 8 deletions src/api/test/functional/source_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4035,8 +4035,7 @@ def test_have_the_same_user_role_twice_in_package_meta
{ 'userid' => 'tom', 'role' => 'bugowner' },
{ 'userid' => 'Iggy', 'role' => 'maintainer' },
{ 'userid' => 'tom', 'role' => 'maintainer' }
]
}, ret)
]}, ret)

ret = duplicated_user_test('package', 'group', '/source/home:Iggy/TestPack/_meta')
assert_equal({ 'name' => 'TestPack',
Expand All @@ -4047,8 +4046,7 @@ def test_have_the_same_user_role_twice_in_package_meta
'group' => [
{ 'groupid' => 'test_group', 'role' => 'bugowner' },
{ 'groupid' => 'test_group', 'role' => 'maintainer' }
]
}, ret)
]}, ret)

ret = duplicated_user_test('project', 'user', '/source/home:Iggy/_meta')
assert_equal({ 'name' => 'home:Iggy',
Expand All @@ -4058,8 +4056,7 @@ def test_have_the_same_user_role_twice_in_package_meta
{ 'userid' => 'tom', 'role' => 'bugowner' },
{ 'userid' => 'Iggy', 'role' => 'maintainer' },
{ 'userid' => 'tom', 'role' => 'maintainer' }
]
}, ret)
]}, ret)

ret = duplicated_user_test('project', 'group', '/source/home:Iggy/_meta')
assert_equal({ 'name' => 'home:Iggy',
Expand All @@ -4069,8 +4066,7 @@ def test_have_the_same_user_role_twice_in_package_meta
'group' => [
{ 'groupid' => 'test_group', 'role' => 'bugowner' },
{ 'groupid' => 'test_group', 'role' => 'maintainer' }
]
}, ret)
]}, ret)

# restore (esp in backend)
login_king
Expand Down

0 comments on commit b82ddcd

Please sign in to comment.