Skip to content

Commit eacae00

Browse files
committed
Enable Style/MultilineHashBraceLayout
1 parent 99a34a5 commit eacae00

20 files changed

+98
-103
lines changed

.rubocop.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ Style/MultilineBlockLayout:
277277
# Checks that the closing brace in a hash literal is either on the same line as
278278
# the last hash element, or a new line.
279279
Style/MultilineHashBraceLayout:
280-
Enabled: false
280+
Enabled: true
281281
EnforcedStyle: symmetrical
282282

283283
# Do not use then for multi-line if/unless.

app/controllers/jwt_controller.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,17 @@ def render_missing_personal_token
3939
message: "HTTP Basic: Access denied\n" \
4040
"You have 2FA enabled, please use a personal access token for Git over HTTP.\n" \
4141
"You can generate one at #{profile_personal_access_tokens_url}" }
42-
] }, status: 401
42+
]
43+
}, status: 401
4344
end
4445

4546
def render_unauthorized
4647
render json: {
4748
errors: [
4849
{ code: 'UNAUTHORIZED',
4950
message: 'HTTP Basic: Access denied' }
50-
] }, status: 401
51+
]
52+
}, status: 401
5153
end
5254

5355
def auth_params

app/controllers/snippets_controller.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ def index
2828
@snippets = SnippetsFinder.new.execute(current_user, {
2929
filter: :by_user,
3030
user: @user,
31-
scope: params[:scope] })
31+
scope: params[:scope]
32+
})
3233
.page(params[:page])
3334

3435
render 'index'

app/models/project_services/chat_message/issue_message.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ def description_message
5151
title: issue_title,
5252
title_link: issue_url,
5353
text: format(description),
54-
color: "#C95823" }]
54+
color: "#C95823"
55+
}]
5556
end
5657

5758
def project_link

app/models/project_services/irker_service.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ def execute(data)
3333
end
3434

3535
def settings
36-
{ server_host: server_host.present? ? server_host : 'localhost',
36+
{
37+
server_host: server_host.present? ? server_host : 'localhost',
3738
server_port: server_port.present? ? server_port : 6659
3839
}
3940
end

app/models/project_services/kubernetes_service.rb

+4-8
Original file line numberDiff line numberDiff line change
@@ -62,23 +62,19 @@ def fields
6262
{ type: 'text',
6363
name: 'namespace',
6464
title: 'Kubernetes namespace',
65-
placeholder: 'Kubernetes namespace',
66-
},
65+
placeholder: 'Kubernetes namespace' },
6766
{ type: 'text',
6867
name: 'api_url',
6968
title: 'API URL',
70-
placeholder: 'Kubernetes API URL, like https://kube.example.com/',
71-
},
69+
placeholder: 'Kubernetes API URL, like https://kube.example.com/' },
7270
{ type: 'text',
7371
name: 'token',
7472
title: 'Service token',
75-
placeholder: 'Service token',
76-
},
73+
placeholder: 'Service token' },
7774
{ type: 'textarea',
7875
name: 'ca_pem',
7976
title: 'Custom CA bundle',
80-
placeholder: 'Certificate Authority bundle (PEM format)',
81-
},
77+
placeholder: 'Certificate Authority bundle (PEM format)' },
8278
]
8379
end
8480

app/models/project_services/pushover_service.rb

+2-4
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ def fields
2929
['Normal Priority', 0],
3030
['High Priority', 1]
3131
],
32-
default_choice: 0
33-
},
32+
default_choice: 0 },
3433
{ type: 'select', name: 'sound', choices:
3534
[
3635
['Device default sound', nil],
@@ -56,8 +55,7 @@ def fields
5655
['Pushover Echo (long)', 'echo'],
5756
['Up Down (long)', 'updown'],
5857
['None (silent)', 'none']
59-
]
60-
},
58+
]},
6159
]
6260
end
6361

lib/gitlab/ci/config/entry/environment.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ class Environment < Node
2121
validates :name,
2222
type: {
2323
with: String,
24-
message: Gitlab::Regex.environment_name_regex_message }
24+
message: Gitlab::Regex.environment_name_regex_message
25+
}
2526

2627
validates :name,
2728
format: {
2829
with: Gitlab::Regex.environment_name_regex,
29-
message: Gitlab::Regex.environment_name_regex_message }
30+
message: Gitlab::Regex.environment_name_regex_message
31+
}
3032

3133
with_options if: :hash? do
3234
validates :config, allowed_keys: ALLOWED_KEYS

spec/controllers/projects/merge_requests_controller_spec.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ def submit_new_merge_request(format: :html)
5454
project_id: fork_project.to_param,
5555
merge_request: {
5656
source_branch: 'remove-submodule',
57-
target_branch: 'master' },
57+
target_branch: 'master'
58+
},
5859
format: format
5960
end
6061
end

spec/lib/expand_variables_spec.rb

+9-18
Original file line numberDiff line numberDiff line change
@@ -7,58 +7,49 @@
77
tests = [
88
{ value: 'key',
99
result: 'key',
10-
variables: []
11-
},
10+
variables: [] },
1211
{ value: 'key$variable',
1312
result: 'key',
14-
variables: []
15-
},
13+
variables: [] },
1614
{ value: 'key$variable',
1715
result: 'keyvalue',
1816
variables: [
1917
{ key: 'variable', value: 'value' }
20-
]
21-
},
18+
]},
2219
{ value: 'key${variable}',
2320
result: 'keyvalue',
2421
variables: [
2522
{ key: 'variable', value: 'value' }
26-
]
27-
},
23+
]},
2824
{ value: 'key$variable$variable2',
2925
result: 'keyvalueresult',
3026
variables: [
3127
{ key: 'variable', value: 'value' },
3228
{ key: 'variable2', value: 'result' },
33-
]
34-
},
29+
]},
3530
{ value: 'key${variable}${variable2}',
3631
result: 'keyvalueresult',
3732
variables: [
3833
{ key: 'variable', value: 'value' },
3934
{ key: 'variable2', value: 'result' }
40-
]
41-
},
35+
]},
4236
{ value: 'key$variable2$variable',
4337
result: 'keyresultvalue',
4438
variables: [
4539
{ key: 'variable', value: 'value' },
4640
{ key: 'variable2', value: 'result' },
47-
]
48-
},
41+
]},
4942
{ value: 'key${variable2}${variable}',
5043
result: 'keyresultvalue',
5144
variables: [
5245
{ key: 'variable', value: 'value' },
5346
{ key: 'variable2', value: 'result' }
54-
]
55-
},
47+
]},
5648
{ value: 'review/$CI_BUILD_REF_NAME',
5749
result: 'review/feature/add-review-apps',
5850
variables: [
5951
{ key: 'CI_BUILD_REF_NAME', value: 'feature/add-review-apps' }
60-
]
61-
},
52+
]},
6253
]
6354

6455
tests.each do |test|

spec/lib/gitlab/template/issue_template_spec.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
create_template: {
1212
user: user,
1313
access: Gitlab::Access::MASTER,
14-
path: 'issue_templates' })
14+
path: 'issue_templates'
15+
})
1516
end
1617

1718
describe '.all' do

spec/lib/gitlab/template/merge_request_template_spec.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
create_template: {
1212
user: user,
1313
access: Gitlab::Access::MASTER,
14-
path: 'merge_request_templates' })
14+
path: 'merge_request_templates'
15+
})
1516
end
1617

1718
describe '.all' do

spec/lib/mattermost/command_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
describe '#create' do
1414
let(:params) do
1515
{ team_id: 'abc',
16-
trigger: 'gitlab'
17-
}
16+
trigger: 'gitlab' }
1817
end
1918

2019
subject { described_class.new(nil).create(params) }
@@ -24,7 +23,8 @@
2423
stub_request(:post, 'http://mattermost.example.com/api/v3/teams/abc/commands/create')
2524
.with(body: {
2625
team_id: 'abc',
27-
trigger: 'gitlab' }.to_json)
26+
trigger: 'gitlab'
27+
}.to_json)
2828
.to_return(
2929
status: 200,
3030
headers: { 'Content-Type' => 'application/json' },

spec/lib/mattermost/team_spec.rb

+13-12
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,19 @@
1414
context 'for valid request' do
1515
let(:response) do
1616
[{
17-
"id" => "xiyro8huptfhdndadpz8r3wnbo",
18-
"create_at" => 1482174222155,
19-
"update_at" => 1482174222155,
20-
"delete_at" => 0,
21-
"display_name" => "chatops",
22-
"name" => "chatops",
23-
"email" => "[email protected]",
24-
"type" => "O",
25-
"company_name" => "",
26-
"allowed_domains" => "",
27-
"invite_id" => "o4utakb9jtb7imctdfzbf9r5ro",
28-
"allow_open_invite" => false }]
17+
"id" => "xiyro8huptfhdndadpz8r3wnbo",
18+
"create_at" => 1482174222155,
19+
"update_at" => 1482174222155,
20+
"delete_at" => 0,
21+
"display_name" => "chatops",
22+
"name" => "chatops",
23+
"email" => "[email protected]",
24+
"type" => "O",
25+
"company_name" => "",
26+
"allowed_domains" => "",
27+
"invite_id" => "o4utakb9jtb7imctdfzbf9r5ro",
28+
"allow_open_invite" => false
29+
}]
2930
end
3031

3132
before do

spec/models/environment_spec.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@
7676
end
7777

7878
describe '#update_merge_request_metrics?' do
79-
{ 'production' => true,
79+
{
80+
'production' => true,
8081
'production/eu' => true,
8182
'production/www.gitlab.com' => true,
8283
'productioneu' => false,

spec/models/project_services/drone_ci_service_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,12 @@ def stub_request(status: 200, body: nil)
9595
is_expected.to eq(:error)
9696
end
9797

98-
{ "killed" => :canceled,
98+
{
99+
"killed" => :canceled,
99100
"failure" => :failed,
100101
"error" => :failed,
101-
"success" => "success",
102+
"success" => "success"
102103
}.each do |drone_status, our_status|
103-
104104
it "sets commit status to #{our_status.inspect} when returned status is #{drone_status.inspect}" do
105105
stub_request(body: %({"status":"#{drone_status}"}))
106106

spec/models/project_services/mattermost_slash_commands_service_spec.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
description: "Perform common operations on: #{project.name_with_namespace}",
3737
display_name: "GitLab / #{project.name_with_namespace}",
3838
method: 'P',
39-
username: 'GitLab' }.to_json)
39+
username: 'GitLab'
40+
}.to_json)
4041
.to_return(
4142
status: 200,
4243
headers: { 'Content-Type' => 'application/json' },

0 commit comments

Comments
 (0)