Commit eacae005 authored by Douwe Maan's avatar Douwe Maan

Enable Style/MultilineHashBraceLayout

parent 99a34a52
...@@ -277,7 +277,7 @@ Style/MultilineBlockLayout: ...@@ -277,7 +277,7 @@ Style/MultilineBlockLayout:
# Checks that the closing brace in a hash literal is either on the same line as # Checks that the closing brace in a hash literal is either on the same line as
# the last hash element, or a new line. # the last hash element, or a new line.
Style/MultilineHashBraceLayout: Style/MultilineHashBraceLayout:
Enabled: false Enabled: true
EnforcedStyle: symmetrical EnforcedStyle: symmetrical
# Do not use then for multi-line if/unless. # Do not use then for multi-line if/unless.
......
...@@ -39,7 +39,8 @@ class JwtController < ApplicationController ...@@ -39,7 +39,8 @@ class JwtController < ApplicationController
message: "HTTP Basic: Access denied\n" \ message: "HTTP Basic: Access denied\n" \
"You have 2FA enabled, please use a personal access token for Git over HTTP.\n" \ "You have 2FA enabled, please use a personal access token for Git over HTTP.\n" \
"You can generate one at #{profile_personal_access_tokens_url}" } "You can generate one at #{profile_personal_access_tokens_url}" }
] }, status: 401 ]
}, status: 401
end end
def render_unauthorized def render_unauthorized
...@@ -47,7 +48,8 @@ class JwtController < ApplicationController ...@@ -47,7 +48,8 @@ class JwtController < ApplicationController
errors: [ errors: [
{ code: 'UNAUTHORIZED', { code: 'UNAUTHORIZED',
message: 'HTTP Basic: Access denied' } message: 'HTTP Basic: Access denied' }
] }, status: 401 ]
}, status: 401
end end
def auth_params def auth_params
......
...@@ -28,7 +28,8 @@ class SnippetsController < ApplicationController ...@@ -28,7 +28,8 @@ class SnippetsController < ApplicationController
@snippets = SnippetsFinder.new.execute(current_user, { @snippets = SnippetsFinder.new.execute(current_user, {
filter: :by_user, filter: :by_user,
user: @user, user: @user,
scope: params[:scope] }) scope: params[:scope]
})
.page(params[:page]) .page(params[:page])
render 'index' render 'index'
......
...@@ -51,7 +51,8 @@ module ChatMessage ...@@ -51,7 +51,8 @@ module ChatMessage
title: issue_title, title: issue_title,
title_link: issue_url, title_link: issue_url,
text: format(description), text: format(description),
color: "#C95823" }] color: "#C95823"
}]
end end
def project_link def project_link
......
...@@ -33,7 +33,8 @@ class IrkerService < Service ...@@ -33,7 +33,8 @@ class IrkerService < Service
end end
def settings def settings
{ server_host: server_host.present? ? server_host : 'localhost', {
server_host: server_host.present? ? server_host : 'localhost',
server_port: server_port.present? ? server_port : 6659 server_port: server_port.present? ? server_port : 6659
} }
end end
......
...@@ -62,23 +62,19 @@ class KubernetesService < DeploymentService ...@@ -62,23 +62,19 @@ class KubernetesService < DeploymentService
{ type: 'text', { type: 'text',
name: 'namespace', name: 'namespace',
title: 'Kubernetes namespace', title: 'Kubernetes namespace',
placeholder: 'Kubernetes namespace', placeholder: 'Kubernetes namespace' },
},
{ type: 'text', { type: 'text',
name: 'api_url', name: 'api_url',
title: 'API URL', title: 'API URL',
placeholder: 'Kubernetes API URL, like https://kube.example.com/', placeholder: 'Kubernetes API URL, like https://kube.example.com/' },
},
{ type: 'text', { type: 'text',
name: 'token', name: 'token',
title: 'Service token', title: 'Service token',
placeholder: 'Service token', placeholder: 'Service token' },
},
{ type: 'textarea', { type: 'textarea',
name: 'ca_pem', name: 'ca_pem',
title: 'Custom CA bundle', title: 'Custom CA bundle',
placeholder: 'Certificate Authority bundle (PEM format)', placeholder: 'Certificate Authority bundle (PEM format)' },
},
] ]
end end
......
...@@ -29,8 +29,7 @@ class PushoverService < Service ...@@ -29,8 +29,7 @@ class PushoverService < Service
['Normal Priority', 0], ['Normal Priority', 0],
['High Priority', 1] ['High Priority', 1]
], ],
default_choice: 0 default_choice: 0 },
},
{ type: 'select', name: 'sound', choices: { type: 'select', name: 'sound', choices:
[ [
['Device default sound', nil], ['Device default sound', nil],
...@@ -56,8 +55,7 @@ class PushoverService < Service ...@@ -56,8 +55,7 @@ class PushoverService < Service
['Pushover Echo (long)', 'echo'], ['Pushover Echo (long)', 'echo'],
['Up Down (long)', 'updown'], ['Up Down (long)', 'updown'],
['None (silent)', 'none'] ['None (silent)', 'none']
] ]},
},
] ]
end end
......
...@@ -21,12 +21,14 @@ module Gitlab ...@@ -21,12 +21,14 @@ module Gitlab
validates :name, validates :name,
type: { type: {
with: String, with: String,
message: Gitlab::Regex.environment_name_regex_message } message: Gitlab::Regex.environment_name_regex_message
}
validates :name, validates :name,
format: { format: {
with: Gitlab::Regex.environment_name_regex, with: Gitlab::Regex.environment_name_regex,
message: Gitlab::Regex.environment_name_regex_message } message: Gitlab::Regex.environment_name_regex_message
}
with_options if: :hash? do with_options if: :hash? do
validates :config, allowed_keys: ALLOWED_KEYS validates :config, allowed_keys: ALLOWED_KEYS
......
...@@ -54,7 +54,8 @@ describe Projects::MergeRequestsController do ...@@ -54,7 +54,8 @@ describe Projects::MergeRequestsController do
project_id: fork_project.to_param, project_id: fork_project.to_param,
merge_request: { merge_request: {
source_branch: 'remove-submodule', source_branch: 'remove-submodule',
target_branch: 'master' }, target_branch: 'master'
},
format: format format: format
end end
end end
......
...@@ -7,58 +7,49 @@ describe ExpandVariables do ...@@ -7,58 +7,49 @@ describe ExpandVariables do
tests = [ tests = [
{ value: 'key', { value: 'key',
result: 'key', result: 'key',
variables: [] variables: [] },
},
{ value: 'key$variable', { value: 'key$variable',
result: 'key', result: 'key',
variables: [] variables: [] },
},
{ value: 'key$variable', { value: 'key$variable',
result: 'keyvalue', result: 'keyvalue',
variables: [ variables: [
{ key: 'variable', value: 'value' } { key: 'variable', value: 'value' }
] ]},
},
{ value: 'key${variable}', { value: 'key${variable}',
result: 'keyvalue', result: 'keyvalue',
variables: [ variables: [
{ key: 'variable', value: 'value' } { key: 'variable', value: 'value' }
] ]},
},
{ value: 'key$variable$variable2', { value: 'key$variable$variable2',
result: 'keyvalueresult', result: 'keyvalueresult',
variables: [ variables: [
{ key: 'variable', value: 'value' }, { key: 'variable', value: 'value' },
{ key: 'variable2', value: 'result' }, { key: 'variable2', value: 'result' },
] ]},
},
{ value: 'key${variable}${variable2}', { value: 'key${variable}${variable2}',
result: 'keyvalueresult', result: 'keyvalueresult',
variables: [ variables: [
{ key: 'variable', value: 'value' }, { key: 'variable', value: 'value' },
{ key: 'variable2', value: 'result' } { key: 'variable2', value: 'result' }
] ]},
},
{ value: 'key$variable2$variable', { value: 'key$variable2$variable',
result: 'keyresultvalue', result: 'keyresultvalue',
variables: [ variables: [
{ key: 'variable', value: 'value' }, { key: 'variable', value: 'value' },
{ key: 'variable2', value: 'result' }, { key: 'variable2', value: 'result' },
] ]},
},
{ value: 'key${variable2}${variable}', { value: 'key${variable2}${variable}',
result: 'keyresultvalue', result: 'keyresultvalue',
variables: [ variables: [
{ key: 'variable', value: 'value' }, { key: 'variable', value: 'value' },
{ key: 'variable2', value: 'result' } { key: 'variable2', value: 'result' }
] ]},
},
{ value: 'review/$CI_BUILD_REF_NAME', { value: 'review/$CI_BUILD_REF_NAME',
result: 'review/feature/add-review-apps', result: 'review/feature/add-review-apps',
variables: [ variables: [
{ key: 'CI_BUILD_REF_NAME', value: 'feature/add-review-apps' } { key: 'CI_BUILD_REF_NAME', value: 'feature/add-review-apps' }
] ]},
},
] ]
tests.each do |test| tests.each do |test|
......
...@@ -11,7 +11,8 @@ describe Gitlab::Template::IssueTemplate do ...@@ -11,7 +11,8 @@ describe Gitlab::Template::IssueTemplate do
create_template: { create_template: {
user: user, user: user,
access: Gitlab::Access::MASTER, access: Gitlab::Access::MASTER,
path: 'issue_templates' }) path: 'issue_templates'
})
end end
describe '.all' do describe '.all' do
......
...@@ -11,7 +11,8 @@ describe Gitlab::Template::MergeRequestTemplate do ...@@ -11,7 +11,8 @@ describe Gitlab::Template::MergeRequestTemplate do
create_template: { create_template: {
user: user, user: user,
access: Gitlab::Access::MASTER, access: Gitlab::Access::MASTER,
path: 'merge_request_templates' }) path: 'merge_request_templates'
})
end end
describe '.all' do describe '.all' do
......
...@@ -13,8 +13,7 @@ describe Mattermost::Command do ...@@ -13,8 +13,7 @@ describe Mattermost::Command do
describe '#create' do describe '#create' do
let(:params) do let(:params) do
{ team_id: 'abc', { team_id: 'abc',
trigger: 'gitlab' trigger: 'gitlab' }
}
end end
subject { described_class.new(nil).create(params) } subject { described_class.new(nil).create(params) }
...@@ -24,7 +23,8 @@ describe Mattermost::Command do ...@@ -24,7 +23,8 @@ describe Mattermost::Command do
stub_request(:post, 'http://mattermost.example.com/api/v3/teams/abc/commands/create') stub_request(:post, 'http://mattermost.example.com/api/v3/teams/abc/commands/create')
.with(body: { .with(body: {
team_id: 'abc', team_id: 'abc',
trigger: 'gitlab' }.to_json) trigger: 'gitlab'
}.to_json)
.to_return( .to_return(
status: 200, status: 200,
headers: { 'Content-Type' => 'application/json' }, headers: { 'Content-Type' => 'application/json' },
......
...@@ -14,18 +14,19 @@ describe Mattermost::Team do ...@@ -14,18 +14,19 @@ describe Mattermost::Team do
context 'for valid request' do context 'for valid request' do
let(:response) do let(:response) do
[{ [{
"id" => "xiyro8huptfhdndadpz8r3wnbo", "id" => "xiyro8huptfhdndadpz8r3wnbo",
"create_at" => 1482174222155, "create_at" => 1482174222155,
"update_at" => 1482174222155, "update_at" => 1482174222155,
"delete_at" => 0, "delete_at" => 0,
"display_name" => "chatops", "display_name" => "chatops",
"name" => "chatops", "name" => "chatops",
"email" => "admin@example.com", "email" => "admin@example.com",
"type" => "O", "type" => "O",
"company_name" => "", "company_name" => "",
"allowed_domains" => "", "allowed_domains" => "",
"invite_id" => "o4utakb9jtb7imctdfzbf9r5ro", "invite_id" => "o4utakb9jtb7imctdfzbf9r5ro",
"allow_open_invite" => false }] "allow_open_invite" => false
}]
end end
before do before do
......
...@@ -76,7 +76,8 @@ describe Environment, models: true do ...@@ -76,7 +76,8 @@ describe Environment, models: true do
end end
describe '#update_merge_request_metrics?' do describe '#update_merge_request_metrics?' do
{ 'production' => true, {
'production' => true,
'production/eu' => true, 'production/eu' => true,
'production/www.gitlab.com' => true, 'production/www.gitlab.com' => true,
'productioneu' => false, 'productioneu' => false,
......
...@@ -95,12 +95,12 @@ describe DroneCiService, models: true, caching: true do ...@@ -95,12 +95,12 @@ describe DroneCiService, models: true, caching: true do
is_expected.to eq(:error) is_expected.to eq(:error)
end end
{ "killed" => :canceled, {
"killed" => :canceled,
"failure" => :failed, "failure" => :failed,
"error" => :failed, "error" => :failed,
"success" => "success", "success" => "success"
}.each do |drone_status, our_status| }.each do |drone_status, our_status|
it "sets commit status to #{our_status.inspect} when returned status is #{drone_status.inspect}" do it "sets commit status to #{our_status.inspect} when returned status is #{drone_status.inspect}" do
stub_request(body: %({"status":"#{drone_status}"})) stub_request(body: %({"status":"#{drone_status}"}))
......
...@@ -36,7 +36,8 @@ describe MattermostSlashCommandsService, :models do ...@@ -36,7 +36,8 @@ describe MattermostSlashCommandsService, :models do
description: "Perform common operations on: #{project.name_with_namespace}", description: "Perform common operations on: #{project.name_with_namespace}",
display_name: "GitLab / #{project.name_with_namespace}", display_name: "GitLab / #{project.name_with_namespace}",
method: 'P', method: 'P',
username: 'GitLab' }.to_json) username: 'GitLab'
}.to_json)
.to_return( .to_return(
status: 200, status: 200,
headers: { 'Content-Type' => 'application/json' }, headers: { 'Content-Type' => 'application/json' },
......
...@@ -25,11 +25,9 @@ describe 'Git LFS API and storage' do ...@@ -25,11 +25,9 @@ describe 'Git LFS API and storage' do
{ {
'objects' => [ 'objects' => [
{ 'oid' => '91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897', { 'oid' => '91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897',
'size' => 1575078 'size' => 1575078 },
},
{ 'oid' => sample_oid, { 'oid' => sample_oid,
'size' => sample_size 'size' => sample_size }
}
], ],
'operation' => 'upload' 'operation' => 'upload'
} }
...@@ -53,11 +51,9 @@ describe 'Git LFS API and storage' do ...@@ -53,11 +51,9 @@ describe 'Git LFS API and storage' do
{ {
'objects' => [ 'objects' => [
{ 'oid' => '91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897', { 'oid' => '91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897',
'size' => 1575078 'size' => 1575078 },
},
{ 'oid' => sample_oid, { 'oid' => sample_oid,
'size' => sample_size 'size' => sample_size }
}
], ],
'operation' => 'upload' 'operation' => 'upload'
} }
...@@ -378,8 +374,7 @@ describe 'Git LFS API and storage' do ...@@ -378,8 +374,7 @@ describe 'Git LFS API and storage' do
'operation' => 'download', 'operation' => 'download',
'objects' => [ 'objects' => [
{ 'oid' => sample_oid, { 'oid' => sample_oid,
'size' => sample_size 'size' => sample_size }
}
] ]
} }
end end
...@@ -397,7 +392,8 @@ describe 'Git LFS API and storage' do ...@@ -397,7 +392,8 @@ describe 'Git LFS API and storage' do
it 'with href to download' do it 'with href to download' do
expect(json_response).to eq({ expect(json_response).to eq({
'objects' => [ 'objects' => [
{ 'oid' => sample_oid, {
'oid' => sample_oid,
'size' => sample_size, 'size' => sample_size,
'actions' => { 'actions' => {
'download' => { 'download' => {
...@@ -424,7 +420,8 @@ describe 'Git LFS API and storage' do ...@@ -424,7 +420,8 @@ describe 'Git LFS API and storage' do
it 'with href to download' do it 'with href to download' do
expect(json_response).to eq({ expect(json_response).to eq({
'objects' => [ 'objects' => [
{ 'oid' => sample_oid, {
'oid' => sample_oid,
'size' => sample_size, 'size' => sample_size,
'error' => { 'error' => {
'code' => 404, 'code' => 404,
...@@ -442,8 +439,7 @@ describe 'Git LFS API and storage' do ...@@ -442,8 +439,7 @@ describe 'Git LFS API and storage' do
'operation' => 'download', 'operation' => 'download',
'objects' => [ 'objects' => [
{ 'oid' => '91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897', { 'oid' => '91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897',
'size' => 1575078 'size' => 1575078 }
}
] ]
} }
end end
...@@ -455,7 +451,8 @@ describe 'Git LFS API and storage' do ...@@ -455,7 +451,8 @@ describe 'Git LFS API and storage' do
it 'with an 404 for specific object' do it 'with an 404 for specific object' do
expect(json_response).to eq({ expect(json_response).to eq({
'objects' => [ 'objects' => [
{ 'oid' => '91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897', {
'oid' => '91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897',
'size' => 1575078, 'size' => 1575078,
'error' => { 'error' => {
'code' => 404, 'code' => 404,
...@@ -469,14 +466,13 @@ describe 'Git LFS API and storage' do ...@@ -469,14 +466,13 @@ describe 'Git LFS API and storage' do
context 'when downloading one new and one existing lfs object' do context 'when downloading one new and one existing lfs object' do
let(:body) do let(:body) do
{ 'operation' => 'download', {
'operation' => 'download',
'objects' => [ 'objects' => [
{ 'oid' => '91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897', { 'oid' => '91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897',
'size' => 1575078 'size' => 1575078 },
},
{ 'oid' => sample_oid, { 'oid' => sample_oid,
'size' => sample_size 'size' => sample_size }
}
] ]
} }
end end
...@@ -617,7 +613,8 @@ describe 'Git LFS API and storage' do ...@@ -617,7 +613,8 @@ describe 'Git LFS API and storage' do
it 'responds with status 200 and href to download' do it 'responds with status 200 and href to download' do
expect(json_response).to eq({ expect(json_response).to eq({
'objects' => [ 'objects' => [
{ 'oid' => sample_oid, {
'oid' => sample_oid,
'size' => sample_size, 'size' => sample_size,
'authenticated' => true, 'authenticated' => true,
'actions' => { 'actions' => {
...@@ -651,8 +648,7 @@ describe 'Git LFS API and storage' do ...@@ -651,8 +648,7 @@ describe 'Git LFS API and storage' do
'operation' => 'upload', 'operation' => 'upload',
'objects' => [ 'objects' => [
{ 'oid' => sample_oid, { 'oid' => sample_oid,
'size' => sample_size 'size' => sample_size }
}
] ]
} }
end end
...@@ -692,8 +688,7 @@ describe 'Git LFS API and storage' do ...@@ -692,8 +688,7 @@ describe 'Git LFS API and storage' do
'operation' => 'upload', 'operation' => 'upload',
'objects' => [ 'objects' => [
{ 'oid' => '91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897', { 'oid' => '91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897',
'size' => 1575078 'size' => 1575078 }
}
] ]
} }
end end
...@@ -713,14 +708,13 @@ describe 'Git LFS API and storage' do ...@@ -713,14 +708,13 @@ describe 'Git LFS API and storage' do
context 'when pushing one new and one existing lfs object' do context 'when pushing one new and one existing lfs object' do
let(:body) do let(:body) do
{ 'operation' => 'upload', {
'operation' => 'upload',
'objects' => [ 'objects' => [
{ 'oid' => '91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897', { 'oid' => '91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897',
'size' => 1575078 'size' => 1575078 },
},
{ 'oid' => sample_oid, { 'oid' => sample_oid,
'size' => sample_size 'size' => sample_size }
}
] ]
} }
end end
...@@ -818,8 +812,7 @@ describe 'Git LFS API and storage' do ...@@ -818,8 +812,7 @@ describe 'Git LFS API and storage' do
'operation' => 'other', 'operation' => 'other',
'objects' => [ 'objects' => [
{ 'oid' => sample_oid, { 'oid' => sample_oid,
'size' => sample_size 'size' => sample_size }
}
] ]
} }
end end
......
...@@ -9,7 +9,8 @@ describe CreateDeploymentService, services: true do ...@@ -9,7 +9,8 @@ describe CreateDeploymentService, services: true do
describe '#execute' do describe '#execute' do
let(:options) { nil } let(:options) { nil }
let(:params) do let(:params) do
{ environment: 'production', {
environment: 'production',
ref: 'master', ref: 'master',
tag: false, tag: false,
sha: '97de212e80737a608d939f648d959671fb0a0142', sha: '97de212e80737a608d939f648d959671fb0a0142',
...@@ -83,10 +84,11 @@ describe CreateDeploymentService, services: true do ...@@ -83,10 +84,11 @@ describe CreateDeploymentService, services: true do
context 'for environment with invalid name' do context 'for environment with invalid name' do
let(:params) do let(:params) do
{ environment: 'name,with,commas', {
environment: 'name,with,commas',
ref: 'master', ref: 'master',
tag: false, tag: false,
sha: '97de212e80737a608d939f648d959671fb0a0142', sha: '97de212e80737a608d939f648d959671fb0a0142'
} }
end end
...@@ -101,7 +103,8 @@ describe CreateDeploymentService, services: true do ...@@ -101,7 +103,8 @@ describe CreateDeploymentService, services: true do
context 'when variables are used' do context 'when variables are used' do
let(:params) do let(:params) do
{ environment: 'review-apps/$CI_BUILD_REF_NAME', {
environment: 'review-apps/$CI_BUILD_REF_NAME',
ref: 'master', ref: 'master',
tag: false, tag: false,
sha: '97de212e80737a608d939f648d959671fb0a0142', sha: '97de212e80737a608d939f648d959671fb0a0142',
......
...@@ -2,23 +2,24 @@ module KubernetesHelpers ...@@ -2,23 +2,24 @@ module KubernetesHelpers
include Gitlab::Kubernetes include Gitlab::Kubernetes
def kube_discovery_body def kube_discovery_body
{ "kind" => "APIResourceList", {
"kind" => "APIResourceList",
"resources" => [ "resources" => [
{ "name" => "pods", "namespaced" => true, "kind" => "Pod" }, { "name" => "pods", "namespaced" => true, "kind" => "Pod" },
], ]
} }
end end
def kube_pods_body(*pods) def kube_pods_body(*pods)
{ "kind" => "PodList", { "kind" => "PodList",
"items" => [kube_pod], "items" => [kube_pod] }
}
end end
# This is a partial response, it will have many more elements in reality but # This is a partial response, it will have many more elements in reality but
# these are the ones we care about at the moment # these are the ones we care about at the moment
def kube_pod(app: "valid-pod-label") def kube_pod(app: "valid-pod-label")
{ "metadata" => { {
"metadata" => {
"name" => "kube-pod", "name" => "kube-pod",
"creationTimestamp" => "2016-11-25T19:55:19Z", "creationTimestamp" => "2016-11-25T19:55:19Z",
"labels" => { "app" => app }, "labels" => { "app" => app },
...@@ -29,7 +30,7 @@ module KubernetesHelpers ...@@ -29,7 +30,7 @@ module KubernetesHelpers
{ "name" => "container-1" }, { "name" => "container-1" },
], ],
}, },
"status" => { "phase" => "Running" }, "status" => { "phase" => "Running" }
} }
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment