Enable Style/MultilineHashBraceLayout

This commit is contained in:
Douwe Maan 2017-02-22 11:44:44 -06:00
parent 99a34a52d7
commit eacae00516
20 changed files with 98 additions and 103 deletions

View File

@ -277,7 +277,7 @@ Style/MultilineBlockLayout:
# Checks that the closing brace in a hash literal is either on the same line as
# the last hash element, or a new line.
Style/MultilineHashBraceLayout:
Enabled: false
Enabled: true
EnforcedStyle: symmetrical
# Do not use then for multi-line if/unless.

View File

@ -39,7 +39,8 @@ class JwtController < ApplicationController
message: "HTTP Basic: Access denied\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}" }
] }, status: 401
]
}, status: 401
end
def render_unauthorized
@ -47,7 +48,8 @@ class JwtController < ApplicationController
errors: [
{ code: 'UNAUTHORIZED',
message: 'HTTP Basic: Access denied' }
] }, status: 401
]
}, status: 401
end
def auth_params

View File

@ -28,7 +28,8 @@ class SnippetsController < ApplicationController
@snippets = SnippetsFinder.new.execute(current_user, {
filter: :by_user,
user: @user,
scope: params[:scope] })
scope: params[:scope]
})
.page(params[:page])
render 'index'

View File

@ -51,7 +51,8 @@ module ChatMessage
title: issue_title,
title_link: issue_url,
text: format(description),
color: "#C95823" }]
color: "#C95823"
}]
end
def project_link

View File

@ -33,7 +33,8 @@ class IrkerService < Service
end
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
}
end

View File

@ -62,23 +62,19 @@ class KubernetesService < DeploymentService
{ type: 'text',
name: 'namespace',
title: 'Kubernetes namespace',
placeholder: 'Kubernetes namespace',
},
placeholder: 'Kubernetes namespace' },
{ type: 'text',
name: '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',
name: 'token',
title: 'Service token',
placeholder: 'Service token',
},
placeholder: 'Service token' },
{ type: 'textarea',
name: 'ca_pem',
title: 'Custom CA bundle',
placeholder: 'Certificate Authority bundle (PEM format)',
},
placeholder: 'Certificate Authority bundle (PEM format)' },
]
end

View File

@ -29,8 +29,7 @@ class PushoverService < Service
['Normal Priority', 0],
['High Priority', 1]
],
default_choice: 0
},
default_choice: 0 },
{ type: 'select', name: 'sound', choices:
[
['Device default sound', nil],
@ -56,8 +55,7 @@ class PushoverService < Service
['Pushover Echo (long)', 'echo'],
['Up Down (long)', 'updown'],
['None (silent)', 'none']
]
},
]},
]
end

View File

@ -21,12 +21,14 @@ module Gitlab
validates :name,
type: {
with: String,
message: Gitlab::Regex.environment_name_regex_message }
message: Gitlab::Regex.environment_name_regex_message
}
validates :name,
format: {
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
validates :config, allowed_keys: ALLOWED_KEYS

View File

@ -54,7 +54,8 @@ describe Projects::MergeRequestsController do
project_id: fork_project.to_param,
merge_request: {
source_branch: 'remove-submodule',
target_branch: 'master' },
target_branch: 'master'
},
format: format
end
end

View File

@ -7,58 +7,49 @@ describe ExpandVariables do
tests = [
{ value: 'key',
result: 'key',
variables: []
},
variables: [] },
{ value: 'key$variable',
result: 'key',
variables: []
},
variables: [] },
{ value: 'key$variable',
result: 'keyvalue',
variables: [
{ key: 'variable', value: 'value' }
]
},
]},
{ value: 'key${variable}',
result: 'keyvalue',
variables: [
{ key: 'variable', value: 'value' }
]
},
]},
{ value: 'key$variable$variable2',
result: 'keyvalueresult',
variables: [
{ key: 'variable', value: 'value' },
{ key: 'variable2', value: 'result' },
]
},
]},
{ value: 'key${variable}${variable2}',
result: 'keyvalueresult',
variables: [
{ key: 'variable', value: 'value' },
{ key: 'variable2', value: 'result' }
]
},
]},
{ value: 'key$variable2$variable',
result: 'keyresultvalue',
variables: [
{ key: 'variable', value: 'value' },
{ key: 'variable2', value: 'result' },
]
},
]},
{ value: 'key${variable2}${variable}',
result: 'keyresultvalue',
variables: [
{ key: 'variable', value: 'value' },
{ key: 'variable2', value: 'result' }
]
},
]},
{ value: 'review/$CI_BUILD_REF_NAME',
result: 'review/feature/add-review-apps',
variables: [
{ key: 'CI_BUILD_REF_NAME', value: 'feature/add-review-apps' }
]
},
]},
]
tests.each do |test|

View File

@ -11,7 +11,8 @@ describe Gitlab::Template::IssueTemplate do
create_template: {
user: user,
access: Gitlab::Access::MASTER,
path: 'issue_templates' })
path: 'issue_templates'
})
end
describe '.all' do

View File

@ -11,7 +11,8 @@ describe Gitlab::Template::MergeRequestTemplate do
create_template: {
user: user,
access: Gitlab::Access::MASTER,
path: 'merge_request_templates' })
path: 'merge_request_templates'
})
end
describe '.all' do

View File

@ -13,8 +13,7 @@ describe Mattermost::Command do
describe '#create' do
let(:params) do
{ team_id: 'abc',
trigger: 'gitlab'
}
trigger: 'gitlab' }
end
subject { described_class.new(nil).create(params) }
@ -24,7 +23,8 @@ describe Mattermost::Command do
stub_request(:post, 'http://mattermost.example.com/api/v3/teams/abc/commands/create')
.with(body: {
team_id: 'abc',
trigger: 'gitlab' }.to_json)
trigger: 'gitlab'
}.to_json)
.to_return(
status: 200,
headers: { 'Content-Type' => 'application/json' },

View File

@ -14,18 +14,19 @@ describe Mattermost::Team do
context 'for valid request' do
let(:response) do
[{
"id" => "xiyro8huptfhdndadpz8r3wnbo",
"create_at" => 1482174222155,
"update_at" => 1482174222155,
"delete_at" => 0,
"display_name" => "chatops",
"name" => "chatops",
"email" => "admin@example.com",
"type" => "O",
"company_name" => "",
"allowed_domains" => "",
"invite_id" => "o4utakb9jtb7imctdfzbf9r5ro",
"allow_open_invite" => false }]
"id" => "xiyro8huptfhdndadpz8r3wnbo",
"create_at" => 1482174222155,
"update_at" => 1482174222155,
"delete_at" => 0,
"display_name" => "chatops",
"name" => "chatops",
"email" => "admin@example.com",
"type" => "O",
"company_name" => "",
"allowed_domains" => "",
"invite_id" => "o4utakb9jtb7imctdfzbf9r5ro",
"allow_open_invite" => false
}]
end
before do

View File

@ -76,7 +76,8 @@ describe Environment, models: true do
end
describe '#update_merge_request_metrics?' do
{ 'production' => true,
{
'production' => true,
'production/eu' => true,
'production/www.gitlab.com' => true,
'productioneu' => false,

View File

@ -95,12 +95,12 @@ describe DroneCiService, models: true, caching: true do
is_expected.to eq(:error)
end
{ "killed" => :canceled,
{
"killed" => :canceled,
"failure" => :failed,
"error" => :failed,
"success" => "success",
"success" => "success"
}.each do |drone_status, our_status|
it "sets commit status to #{our_status.inspect} when returned status is #{drone_status.inspect}" do
stub_request(body: %({"status":"#{drone_status}"}))

View File

@ -36,7 +36,8 @@ describe MattermostSlashCommandsService, :models do
description: "Perform common operations on: #{project.name_with_namespace}",
display_name: "GitLab / #{project.name_with_namespace}",
method: 'P',
username: 'GitLab' }.to_json)
username: 'GitLab'
}.to_json)
.to_return(
status: 200,
headers: { 'Content-Type' => 'application/json' },

View File

@ -25,11 +25,9 @@ describe 'Git LFS API and storage' do
{
'objects' => [
{ 'oid' => '91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897',
'size' => 1575078
},
'size' => 1575078 },
{ 'oid' => sample_oid,
'size' => sample_size
}
'size' => sample_size }
],
'operation' => 'upload'
}
@ -53,11 +51,9 @@ describe 'Git LFS API and storage' do
{
'objects' => [
{ 'oid' => '91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897',
'size' => 1575078
},
'size' => 1575078 },
{ 'oid' => sample_oid,
'size' => sample_size
}
'size' => sample_size }
],
'operation' => 'upload'
}
@ -378,8 +374,7 @@ describe 'Git LFS API and storage' do
'operation' => 'download',
'objects' => [
{ 'oid' => sample_oid,
'size' => sample_size
}
'size' => sample_size }
]
}
end
@ -397,7 +392,8 @@ describe 'Git LFS API and storage' do
it 'with href to download' do
expect(json_response).to eq({
'objects' => [
{ 'oid' => sample_oid,
{
'oid' => sample_oid,
'size' => sample_size,
'actions' => {
'download' => {
@ -424,7 +420,8 @@ describe 'Git LFS API and storage' do
it 'with href to download' do
expect(json_response).to eq({
'objects' => [
{ 'oid' => sample_oid,
{
'oid' => sample_oid,
'size' => sample_size,
'error' => {
'code' => 404,
@ -442,8 +439,7 @@ describe 'Git LFS API and storage' do
'operation' => 'download',
'objects' => [
{ 'oid' => '91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897',
'size' => 1575078
}
'size' => 1575078 }
]
}
end
@ -455,7 +451,8 @@ describe 'Git LFS API and storage' do
it 'with an 404 for specific object' do
expect(json_response).to eq({
'objects' => [
{ 'oid' => '91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897',
{
'oid' => '91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897',
'size' => 1575078,
'error' => {
'code' => 404,
@ -469,14 +466,13 @@ describe 'Git LFS API and storage' do
context 'when downloading one new and one existing lfs object' do
let(:body) do
{ 'operation' => 'download',
{
'operation' => 'download',
'objects' => [
{ 'oid' => '91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897',
'size' => 1575078
},
'size' => 1575078 },
{ 'oid' => sample_oid,
'size' => sample_size
}
'size' => sample_size }
]
}
end
@ -617,7 +613,8 @@ describe 'Git LFS API and storage' do
it 'responds with status 200 and href to download' do
expect(json_response).to eq({
'objects' => [
{ 'oid' => sample_oid,
{
'oid' => sample_oid,
'size' => sample_size,
'authenticated' => true,
'actions' => {
@ -651,8 +648,7 @@ describe 'Git LFS API and storage' do
'operation' => 'upload',
'objects' => [
{ 'oid' => sample_oid,
'size' => sample_size
}
'size' => sample_size }
]
}
end
@ -692,8 +688,7 @@ describe 'Git LFS API and storage' do
'operation' => 'upload',
'objects' => [
{ 'oid' => '91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897',
'size' => 1575078
}
'size' => 1575078 }
]
}
end
@ -713,14 +708,13 @@ describe 'Git LFS API and storage' do
context 'when pushing one new and one existing lfs object' do
let(:body) do
{ 'operation' => 'upload',
{
'operation' => 'upload',
'objects' => [
{ 'oid' => '91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897',
'size' => 1575078
},
'size' => 1575078 },
{ 'oid' => sample_oid,
'size' => sample_size
}
'size' => sample_size }
]
}
end
@ -818,8 +812,7 @@ describe 'Git LFS API and storage' do
'operation' => 'other',
'objects' => [
{ 'oid' => sample_oid,
'size' => sample_size
}
'size' => sample_size }
]
}
end

View File

@ -9,7 +9,8 @@ describe CreateDeploymentService, services: true do
describe '#execute' do
let(:options) { nil }
let(:params) do
{ environment: 'production',
{
environment: 'production',
ref: 'master',
tag: false,
sha: '97de212e80737a608d939f648d959671fb0a0142',
@ -83,10 +84,11 @@ describe CreateDeploymentService, services: true do
context 'for environment with invalid name' do
let(:params) do
{ environment: 'name,with,commas',
{
environment: 'name,with,commas',
ref: 'master',
tag: false,
sha: '97de212e80737a608d939f648d959671fb0a0142',
sha: '97de212e80737a608d939f648d959671fb0a0142'
}
end
@ -101,7 +103,8 @@ describe CreateDeploymentService, services: true do
context 'when variables are used' do
let(:params) do
{ environment: 'review-apps/$CI_BUILD_REF_NAME',
{
environment: 'review-apps/$CI_BUILD_REF_NAME',
ref: 'master',
tag: false,
sha: '97de212e80737a608d939f648d959671fb0a0142',

View File

@ -2,23 +2,24 @@ module KubernetesHelpers
include Gitlab::Kubernetes
def kube_discovery_body
{ "kind" => "APIResourceList",
{
"kind" => "APIResourceList",
"resources" => [
{ "name" => "pods", "namespaced" => true, "kind" => "Pod" },
],
]
}
end
def kube_pods_body(*pods)
{ "kind" => "PodList",
"items" => [kube_pod],
}
"items" => [kube_pod] }
end
# This is a partial response, it will have many more elements in reality but
# these are the ones we care about at the moment
def kube_pod(app: "valid-pod-label")
{ "metadata" => {
{
"metadata" => {
"name" => "kube-pod",
"creationTimestamp" => "2016-11-25T19:55:19Z",
"labels" => { "app" => app },
@ -29,7 +30,7 @@ module KubernetesHelpers
{ "name" => "container-1" },
],
},
"status" => { "phase" => "Running" },
"status" => { "phase" => "Running" }
}
end