Commit 0f8c99d7 authored by Douwe Maan's avatar Douwe Maan

Enable Style/MultilineArrayBraceLayout

parent 785a7038
...@@ -204,6 +204,7 @@ Style/For: ...@@ -204,6 +204,7 @@ Style/For:
# Checks if there is a magic comment to enforce string literals # Checks if there is a magic comment to enforce string literals
Style/FrozenStringLiteralComment: Style/FrozenStringLiteralComment:
Enabled: false Enabled: false
# Do not introduce global variables. # Do not introduce global variables.
Style/GlobalVars: Style/GlobalVars:
Enabled: true Enabled: true
...@@ -262,7 +263,7 @@ Style/ModuleFunction: ...@@ -262,7 +263,7 @@ Style/ModuleFunction:
# Checks that the closing brace in an array literal is either on the same line # Checks that the closing brace in an array literal is either on the same line
# as the last array element, or a new line. # as the last array element, or a new line.
Style/MultilineArrayBraceLayout: Style/MultilineArrayBraceLayout:
Enabled: false Enabled: true
EnforcedStyle: symmetrical EnforcedStyle: symmetrical
# Avoid multi-line chains of blocks. # Avoid multi-line chains of blocks.
......
...@@ -21,11 +21,12 @@ class Settings < Settingslogic ...@@ -21,11 +21,12 @@ class Settings < Settingslogic
else else
":#{gitlab.port}" ":#{gitlab.port}"
end end
[gitlab.protocol, [
"://", gitlab.protocol,
gitlab.host, "://",
custom_port, gitlab.host,
gitlab.relative_url_root custom_port,
gitlab.relative_url_root
].join('') ].join('')
end end
...@@ -106,10 +107,11 @@ class Settings < Settingslogic ...@@ -106,10 +107,11 @@ class Settings < Settingslogic
def base_url(config) def base_url(config)
custom_port = on_standard_port?(config) ? nil : ":#{config.port}" custom_port = on_standard_port?(config) ? nil : ":#{config.port}"
[config.protocol, [
"://", config.protocol,
config.host, "://",
custom_port config.host,
custom_port
] ]
end end
......
...@@ -15,8 +15,9 @@ module API ...@@ -15,8 +15,9 @@ module API
requires :"#{awardable_id_string}", type: Integer, desc: "The ID of an Issue, Merge Request or Snippet" requires :"#{awardable_id_string}", type: Integer, desc: "The ID of an Issue, Merge Request or Snippet"
end end
[":id/#{awardable_string}/:#{awardable_id_string}/award_emoji", [
":id/#{awardable_string}/:#{awardable_id_string}/notes/:note_id/award_emoji" ":id/#{awardable_string}/:#{awardable_id_string}/award_emoji",
":id/#{awardable_string}/:#{awardable_id_string}/notes/:note_id/award_emoji"
].each do |endpoint| ].each do |endpoint|
desc 'Get a list of project +awardable+ award emoji' do desc 'Get a list of project +awardable+ award emoji' do
......
...@@ -19,7 +19,8 @@ module API ...@@ -19,7 +19,8 @@ module API
optional :visibility_level, type: Integer, values: [ optional :visibility_level, type: Integer, values: [
Gitlab::VisibilityLevel::PRIVATE, Gitlab::VisibilityLevel::PRIVATE,
Gitlab::VisibilityLevel::INTERNAL, Gitlab::VisibilityLevel::INTERNAL,
Gitlab::VisibilityLevel::PUBLIC], desc: 'Create a public project. The same as visibility_level = 20.' Gitlab::VisibilityLevel::PUBLIC
], desc: 'Create a public project. The same as visibility_level = 20.'
optional :public_builds, type: Boolean, desc: 'Perform public builds' optional :public_builds, type: Boolean, desc: 'Perform public builds'
optional :request_access_enabled, type: Boolean, desc: 'Allow users to request member access' optional :request_access_enabled, type: Boolean, desc: 'Allow users to request member access'
optional :only_allow_merge_if_build_succeeds, type: Boolean, desc: 'Only allow to merge if builds succeed' optional :only_allow_merge_if_build_succeeds, type: Boolean, desc: 'Only allow to merge if builds succeed'
......
...@@ -20,7 +20,8 @@ module API ...@@ -20,7 +20,8 @@ module API
optional :visibility_level, type: Integer, values: [ optional :visibility_level, type: Integer, values: [
Gitlab::VisibilityLevel::PRIVATE, Gitlab::VisibilityLevel::PRIVATE,
Gitlab::VisibilityLevel::INTERNAL, Gitlab::VisibilityLevel::INTERNAL,
Gitlab::VisibilityLevel::PUBLIC], desc: 'Create a public project. The same as visibility_level = 20.' Gitlab::VisibilityLevel::PUBLIC
], desc: 'Create a public project. The same as visibility_level = 20.'
optional :public_builds, type: Boolean, desc: 'Perform public builds' optional :public_builds, type: Boolean, desc: 'Perform public builds'
optional :request_access_enabled, type: Boolean, desc: 'Allow users to request member access' optional :request_access_enabled, type: Boolean, desc: 'Allow users to request member access'
optional :only_allow_merge_if_build_succeeds, type: Boolean, desc: 'Only allow to merge if builds succeed' optional :only_allow_merge_if_build_succeeds, type: Boolean, desc: 'Only allow to merge if builds succeed'
......
...@@ -6,18 +6,19 @@ module Gitlab ...@@ -6,18 +6,19 @@ module Gitlab
module SVG module SVG
class Whitelist class Whitelist
ALLOWED_ELEMENTS = %w[ ALLOWED_ELEMENTS = %w[
a altGlyph altGlyphDef altGlyphItem animate a altGlyph altGlyphDef altGlyphItem animate
animateColor animateMotion animateTransform circle clipPath color-profile animateColor animateMotion animateTransform circle clipPath color-profile
cursor defs desc ellipse feBlend feColorMatrix feComponentTransfer cursor defs desc ellipse feBlend feColorMatrix feComponentTransfer
feComposite feConvolveMatrix feDiffuseLighting feDisplacementMap feComposite feConvolveMatrix feDiffuseLighting feDisplacementMap
feDistantLight feFlood feFuncA feFuncB feFuncG feFuncR feGaussianBlur feDistantLight feFlood feFuncA feFuncB feFuncG feFuncR feGaussianBlur
feImage feMerge feMergeNode feMorphology feOffset fePointLight feImage feMerge feMergeNode feMorphology feOffset fePointLight
feSpecularLighting feSpotLight feTile feTurbulence filter font font-face feSpecularLighting feSpotLight feTile feTurbulence filter font font-face
font-face-format font-face-name font-face-src font-face-uri foreignObject font-face-format font-face-name font-face-src font-face-uri foreignObject
g glyph glyphRef hkern image line linearGradient marker mask metadata g glyph glyphRef hkern image line linearGradient marker mask metadata
missing-glyph mpath path pattern polygon polyline radialGradient rect missing-glyph mpath path pattern polygon polyline radialGradient rect
script set stop style svg switch symbol text textPath title tref tspan use script set stop style svg switch symbol text textPath title tref tspan use
view vkern].freeze view vkern
].freeze
ALLOWED_DATA_ATTRIBUTES_IN_ELEMENTS = %w[svg].freeze ALLOWED_DATA_ATTRIBUTES_IN_ELEMENTS = %w[svg].freeze
......
...@@ -151,9 +151,11 @@ describe Gitlab::OAuth::User, lib: true do ...@@ -151,9 +151,11 @@ describe Gitlab::OAuth::User, lib: true do
expect(gl_user.identities.length).to eql 2 expect(gl_user.identities.length).to eql 2
identities_as_hash = gl_user.identities.map { |id| { provider: id.provider, extern_uid: id.extern_uid } } identities_as_hash = gl_user.identities.map { |id| { provider: id.provider, extern_uid: id.extern_uid } }
expect(identities_as_hash).to match_array( expect(identities_as_hash).to match_array(
[{ provider: 'ldapmain', extern_uid: 'uid=user1,ou=People,dc=example' }, [
{ provider: 'twitter', extern_uid: uid } { provider: 'ldapmain', extern_uid: 'uid=user1,ou=People,dc=example' },
]) { provider: 'twitter', extern_uid: uid }
]
)
end end
end end
...@@ -170,9 +172,11 @@ describe Gitlab::OAuth::User, lib: true do ...@@ -170,9 +172,11 @@ describe Gitlab::OAuth::User, lib: true do
expect(gl_user.identities.length).to eql 2 expect(gl_user.identities.length).to eql 2
identities_as_hash = gl_user.identities.map { |id| { provider: id.provider, extern_uid: id.extern_uid } } identities_as_hash = gl_user.identities.map { |id| { provider: id.provider, extern_uid: id.extern_uid } }
expect(identities_as_hash).to match_array( expect(identities_as_hash).to match_array(
[{ provider: 'ldapmain', extern_uid: 'uid=user1,ou=People,dc=example' }, [
{ provider: 'twitter', extern_uid: uid } { provider: 'ldapmain', extern_uid: 'uid=user1,ou=People,dc=example' },
]) { provider: 'twitter', extern_uid: uid }
]
)
end end
end end
......
...@@ -211,8 +211,7 @@ describe Gitlab::Saml::User, lib: true do ...@@ -211,8 +211,7 @@ describe Gitlab::Saml::User, lib: true do
expect(gl_user.identities.length).to eql 2 expect(gl_user.identities.length).to eql 2
identities_as_hash = gl_user.identities.map { |id| { provider: id.provider, extern_uid: id.extern_uid } } identities_as_hash = gl_user.identities.map { |id| { provider: id.provider, extern_uid: id.extern_uid } }
expect(identities_as_hash).to match_array([{ provider: 'ldapmain', extern_uid: 'uid=user1,ou=People,dc=example' }, expect(identities_as_hash).to match_array([{ provider: 'ldapmain', extern_uid: 'uid=user1,ou=People,dc=example' },
{ provider: 'saml', extern_uid: uid } { provider: 'saml', extern_uid: uid }])
])
end end
end end
...@@ -234,8 +233,7 @@ describe Gitlab::Saml::User, lib: true do ...@@ -234,8 +233,7 @@ describe Gitlab::Saml::User, lib: true do
expect(gl_user.identities.length).to eql 2 expect(gl_user.identities.length).to eql 2
identities_as_hash = gl_user.identities.map { |id| { provider: id.provider, extern_uid: id.extern_uid } } identities_as_hash = gl_user.identities.map { |id| { provider: id.provider, extern_uid: id.extern_uid } }
expect(identities_as_hash).to match_array([{ provider: 'ldapmain', extern_uid: 'uid=user1,ou=People,dc=example' }, expect(identities_as_hash).to match_array([{ provider: 'ldapmain', extern_uid: 'uid=user1,ou=People,dc=example' },
{ provider: 'saml', extern_uid: uid } { provider: 'saml', extern_uid: uid }])
])
end end
it 'saves successfully on subsequent tries, when both identities are present' do it 'saves successfully on subsequent tries, when both identities are present' do
...@@ -260,8 +258,7 @@ describe Gitlab::Saml::User, lib: true do ...@@ -260,8 +258,7 @@ describe Gitlab::Saml::User, lib: true do
expect(local_gl_user.identities.length).to eql 2 expect(local_gl_user.identities.length).to eql 2
identities_as_hash = local_gl_user.identities.map { |id| { provider: id.provider, extern_uid: id.extern_uid } } identities_as_hash = local_gl_user.identities.map { |id| { provider: id.provider, extern_uid: id.extern_uid } }
expect(identities_as_hash).to match_array([{ provider: 'ldapmain', extern_uid: 'uid=user1,ou=People,dc=example' }, expect(identities_as_hash).to match_array([{ provider: 'ldapmain', extern_uid: 'uid=user1,ou=People,dc=example' },
{ provider: 'saml', extern_uid: 'uid=user1,ou=People,dc=example' } { provider: 'saml', extern_uid: 'uid=user1,ou=People,dc=example' }])
])
end end
end end
end end
......
...@@ -13,6 +13,7 @@ describe Gitlab::Serializer::Ci::Variables do ...@@ -13,6 +13,7 @@ describe Gitlab::Serializer::Ci::Variables do
it 'converts keys into strings' do it 'converts keys into strings' do
is_expected.to eq([ is_expected.to eq([
{ key: 'key', value: 'value', public: true }, { key: 'key', value: 'value', public: true },
{ key: 'wee', value: 1, public: false }]) { key: 'wee', value: 1, public: false }
])
end end
end end
...@@ -27,7 +27,8 @@ describe Gitlab::Upgrader, lib: true do ...@@ -27,7 +27,8 @@ describe Gitlab::Upgrader, lib: true do
'43af3e65a486a9237f29f56d96c3b3da59c24ae0 refs/tags/v7.11.2-ee', '43af3e65a486a9237f29f56d96c3b3da59c24ae0 refs/tags/v7.11.2-ee',
'dac18e7728013a77410e926a1e64225703754a2d refs/tags/v7.11.2-ee^{}', 'dac18e7728013a77410e926a1e64225703754a2d refs/tags/v7.11.2-ee^{}',
'0bf21fd4b46c980c26fd8c90a14b86a4d90cc950 refs/tags/v7.9.4-ee', '0bf21fd4b46c980c26fd8c90a14b86a4d90cc950 refs/tags/v7.9.4-ee',
'b10de29edbaff7219547dc506cb1468ee35065c3 refs/tags/v7.9.4-ee^{}']) 'b10de29edbaff7219547dc506cb1468ee35065c3 refs/tags/v7.9.4-ee^{}'
])
expect(upgrader.latest_version_raw).to eq("v7.11.2") expect(upgrader.latest_version_raw).to eq("v7.11.2")
end end
end end
......
...@@ -374,11 +374,13 @@ describe 'Git LFS API and storage' do ...@@ -374,11 +374,13 @@ describe 'Git LFS API and storage' do
describe 'download' do describe 'download' do
let(:project) { create(:empty_project) } let(:project) { create(:empty_project) }
let(:body) do let(:body) do
{ 'operation' => 'download', {
'operation' => 'download',
'objects' => [ 'objects' => [
{ 'oid' => sample_oid, { 'oid' => sample_oid,
'size' => sample_size 'size' => sample_size
}] }
]
} }
end end
...@@ -393,16 +395,19 @@ describe 'Git LFS API and storage' do ...@@ -393,16 +395,19 @@ describe 'Git LFS API and storage' do
end end
it 'with href to download' do it 'with href to download' do
expect(json_response).to eq('objects' => [ expect(json_response).to eq({
{ 'oid' => sample_oid, 'objects' => [
'size' => sample_size, { 'oid' => sample_oid,
'actions' => { 'size' => sample_size,
'download' => { 'actions' => {
'href' => "#{project.http_url_to_repo}/gitlab-lfs/objects/#{sample_oid}", 'download' => {
'header' => { 'Authorization' => authorization } 'href' => "#{project.http_url_to_repo}/gitlab-lfs/objects/#{sample_oid}",
'header' => { 'Authorization' => authorization }
}
} }
} }
}]) ]
})
end end
end end
...@@ -417,24 +422,29 @@ describe 'Git LFS API and storage' do ...@@ -417,24 +422,29 @@ describe 'Git LFS API and storage' do
end end
it 'with href to download' do it 'with href to download' do
expect(json_response).to eq('objects' => [ expect(json_response).to eq({
{ 'oid' => sample_oid, 'objects' => [
'size' => sample_size, { 'oid' => sample_oid,
'error' => { 'size' => sample_size,
'code' => 404, 'error' => {
'message' => "Object does not exist on the server or you don't have permissions to access it", 'code' => 404,
'message' => "Object does not exist on the server or you don't have permissions to access it",
}
} }
}]) ]
})
end end
end end
context 'when downloading a lfs object that does not exist' do context 'when downloading a lfs object that does not exist' do
let(:body) do let(:body) do
{ 'operation' => 'download', {
'operation' => 'download',
'objects' => [ 'objects' => [
{ 'oid' => '91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897', { 'oid' => '91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897',
'size' => 1575078 'size' => 1575078
}] }
]
} }
end end
...@@ -443,14 +453,17 @@ describe 'Git LFS API and storage' do ...@@ -443,14 +453,17 @@ describe 'Git LFS API and storage' do
end end
it 'with an 404 for specific object' do it 'with an 404 for specific object' do
expect(json_response).to eq('objects' => [ expect(json_response).to eq({
{ 'oid' => '91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897', 'objects' => [
'size' => 1575078, { 'oid' => '91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897',
'error' => { 'size' => 1575078,
'code' => 404, 'error' => {
'message' => "Object does not exist on the server or you don't have permissions to access it", 'code' => 404,
'message' => "Object does not exist on the server or you don't have permissions to access it",
}
} }
}]) ]
})
end end
end end
...@@ -477,23 +490,28 @@ describe 'Git LFS API and storage' do ...@@ -477,23 +490,28 @@ describe 'Git LFS API and storage' do
end end
it 'responds with upload hypermedia link for the new object' do it 'responds with upload hypermedia link for the new object' do
expect(json_response).to eq('objects' => [ expect(json_response).to eq({
{ 'oid' => '91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897', 'objects' => [
'size' => 1575078, {
'error' => { 'oid' => '91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897',
'code' => 404, 'size' => 1575078,
'message' => "Object does not exist on the server or you don't have permissions to access it", 'error' => {
} 'code' => 404,
}, 'message' => "Object does not exist on the server or you don't have permissions to access it",
{ 'oid' => sample_oid, }
'size' => sample_size, },
'actions' => { {
'download' => { 'oid' => sample_oid,
'href' => "#{project.http_url_to_repo}/gitlab-lfs/objects/#{sample_oid}", 'size' => sample_size,
'header' => { 'Authorization' => authorization } 'actions' => {
'download' => {
'href' => "#{project.http_url_to_repo}/gitlab-lfs/objects/#{sample_oid}",
'header' => { 'Authorization' => authorization }
}
} }
} }
}]) ]
})
end end
end end
end end
...@@ -597,17 +615,20 @@ describe 'Git LFS API and storage' do ...@@ -597,17 +615,20 @@ describe 'Git LFS API and storage' do
end end
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('objects' => [ expect(json_response).to eq({
{ 'oid' => sample_oid, 'objects' => [
'size' => sample_size, { 'oid' => sample_oid,
'authenticated' => true, 'size' => sample_size,
'actions' => { 'authenticated' => true,
'download' => { 'actions' => {
'href' => "#{project.http_url_to_repo}/gitlab-lfs/objects/#{sample_oid}", 'download' => {
'header' => {} 'href' => "#{project.http_url_to_repo}/gitlab-lfs/objects/#{sample_oid}",
'header' => {}
}
} }
} }
}]) ]
})
end end
end end
...@@ -626,11 +647,13 @@ describe 'Git LFS API and storage' do ...@@ -626,11 +647,13 @@ describe 'Git LFS API and storage' do
describe 'upload' do describe 'upload' do
let(:project) { create(:project, :public) } let(:project) { create(:project, :public) }
let(:body) do let(:body) do
{ 'operation' => 'upload', {
'operation' => 'upload',
'objects' => [ 'objects' => [
{ 'oid' => sample_oid, { 'oid' => sample_oid,
'size' => sample_size 'size' => sample_size
}] }
]
} }
end end
...@@ -668,11 +691,13 @@ describe 'Git LFS API and storage' do ...@@ -668,11 +691,13 @@ describe 'Git LFS API and storage' do
let(:sample_oid) { '91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897' } let(:sample_oid) { '91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897' }
let(:body) do let(:body) do
{ 'operation' => 'upload', {
'operation' => 'upload',
'objects' => [ 'objects' => [
{ 'oid' => sample_oid, { 'oid' => sample_oid,
'size' => sample_size 'size' => sample_size
}] }
]
} }
end end
...@@ -825,11 +850,13 @@ describe 'Git LFS API and storage' do ...@@ -825,11 +850,13 @@ describe 'Git LFS API and storage' do
let(:project) { create(:empty_project) } let(:project) { create(:empty_project) }
let(:authorization) { authorize_user } let(:authorization) { authorize_user }
let(:body) do let(:body) do
{ 'operation' => 'other', {
'operation' => 'other',
'objects' => [ 'objects' => [
{ 'oid' => sample_oid, { 'oid' => sample_oid,
'size' => sample_size 'size' => sample_size
}] }
]
} }
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