Commit f5a0ac0f authored by Gabriel Mazetto's avatar Gabriel Mazetto

Codestyle: make sure we have space around operators

parent 311fb58c
...@@ -25,7 +25,7 @@ class ExternalWikiService < Service ...@@ -25,7 +25,7 @@ class ExternalWikiService < Service
def execute(_data) def execute(_data)
@response = HTTParty.get(properties['external_wiki_url'], verify: true) rescue nil @response = HTTParty.get(properties['external_wiki_url'], verify: true) rescue nil
if @response !=200 if @response != 200
nil nil
end end
end end
......
...@@ -225,8 +225,8 @@ Settings['gitlab_ci'] ||= Settingslogic.new({}) ...@@ -225,8 +225,8 @@ Settings['gitlab_ci'] ||= Settingslogic.new({})
Settings.gitlab_ci['shared_runners_enabled'] = true if Settings.gitlab_ci['shared_runners_enabled'].nil? Settings.gitlab_ci['shared_runners_enabled'] = true if Settings.gitlab_ci['shared_runners_enabled'].nil?
Settings.gitlab_ci['all_broken_builds'] = true if Settings.gitlab_ci['all_broken_builds'].nil? Settings.gitlab_ci['all_broken_builds'] = true if Settings.gitlab_ci['all_broken_builds'].nil?
Settings.gitlab_ci['add_pusher'] = false if Settings.gitlab_ci['add_pusher'].nil? Settings.gitlab_ci['add_pusher'] = false if Settings.gitlab_ci['add_pusher'].nil?
Settings.gitlab_ci['url'] ||= Settings.send(:build_gitlab_ci_url)
Settings.gitlab_ci['builds_path'] = File.expand_path(Settings.gitlab_ci['builds_path'] || "builds/", Rails.root) Settings.gitlab_ci['builds_path'] = File.expand_path(Settings.gitlab_ci['builds_path'] || "builds/", Rails.root)
Settings.gitlab_ci['url'] ||= Settings.send(:build_gitlab_ci_url)
# #
# Reply by email # Reply by email
......
...@@ -20,7 +20,7 @@ if File.exist?(aws_file) ...@@ -20,7 +20,7 @@ if File.exist?(aws_file)
config.fog_public = false config.fog_public = false
# optional, defaults to {} # optional, defaults to {}
config.fog_attributes = { 'Cache-Control'=>'max-age=315576000' } config.fog_attributes = { 'Cache-Control' => 'max-age=315576000' }
# optional time (in seconds) that authenticated urls will be valid. # optional time (in seconds) that authenticated urls will be valid.
# when fog_public is false and provider is AWS or Google, defaults to 600 # when fog_public is false and provider is AWS or Google, defaults to 600
......
...@@ -74,7 +74,7 @@ class Spinach::Features::DashboardIssues < Spinach::FeatureSteps ...@@ -74,7 +74,7 @@ class Spinach::Features::DashboardIssues < Spinach::FeatureSteps
def project def project
@project ||= begin @project ||= begin
project =create :project project = create :project
project.team << [current_user, :master] project.team << [current_user, :master]
project project
end end
......
...@@ -100,7 +100,7 @@ class Spinach::Features::DashboardMergeRequests < Spinach::FeatureSteps ...@@ -100,7 +100,7 @@ class Spinach::Features::DashboardMergeRequests < Spinach::FeatureSteps
def project def project
@project ||= begin @project ||= begin
project =create :project project = create :project
project.team << [current_user, :master] project.team << [current_user, :master]
project project
end end
......
...@@ -2,7 +2,7 @@ module API ...@@ -2,7 +2,7 @@ module API
module Helpers module Helpers
PRIVATE_TOKEN_HEADER = "HTTP_PRIVATE_TOKEN" PRIVATE_TOKEN_HEADER = "HTTP_PRIVATE_TOKEN"
PRIVATE_TOKEN_PARAM = :private_token PRIVATE_TOKEN_PARAM = :private_token
SUDO_HEADER ="HTTP_SUDO" SUDO_HEADER = "HTTP_SUDO"
SUDO_PARAM = :sudo SUDO_PARAM = :sudo
def parse_boolean(value) def parse_boolean(value)
......
...@@ -65,7 +65,7 @@ module Gitlab ...@@ -65,7 +65,7 @@ module Gitlab
(l =~ /On \w+ \d+,? \d+,?.*wrote:/) (l =~ /On \w+ \d+,? \d+,?.*wrote:/)
# Headers on subsequent lines # Headers on subsequent lines
break if (0..2).all? { |off| lines[idx+off] =~ REPLYING_HEADER_REGEX } break if (0..2).all? { |off| lines[idx + off] =~ REPLYING_HEADER_REGEX }
# Headers on the same line # Headers on the same line
break if REPLYING_HEADER_LABELS.count { |label| l.include?(label) } >= 3 break if REPLYING_HEADER_LABELS.count { |label| l.include?(label) } >= 3
......
...@@ -43,7 +43,7 @@ module Gitlab ...@@ -43,7 +43,7 @@ module Gitlab
@url = "redis://localhost:6379" @url = "redis://localhost:6379"
if File.exist?(config_file) if File.exist?(config_file)
@url =YAML.load_file(config_file)[rails_env] @url = YAML.load_file(config_file)[rails_env]
end end
end end
end end
......
...@@ -10,8 +10,8 @@ describe Gitlab::Ci::Build::Artifacts::Metadata::Entry do ...@@ -10,8 +10,8 @@ describe Gitlab::Ci::Build::Artifacts::Metadata::Entry do
'path/dir_1/subdir/subfile' => { size: 10 }, 'path/dir_1/subdir/subfile' => { size: 10 },
'path/second_dir' => {}, 'path/second_dir' => {},
'path/second_dir/dir_3/file_2' => { size: 10 }, 'path/second_dir/dir_3/file_2' => { size: 10 },
'path/second_dir/dir_3/file_3'=> { size: 10 }, 'path/second_dir/dir_3/file_3' => { size: 10 },
'another_directory/'=> {}, 'another_directory/' => {},
'another_file' => {}, 'another_file' => {},
'/file/with/absolute_path' => {} } '/file/with/absolute_path' => {} }
end end
......
...@@ -26,8 +26,8 @@ describe Gitlab::Lfs::Router, lib: true do ...@@ -26,8 +26,8 @@ describe Gitlab::Lfs::Router, lib: true do
let(:sample_oid) { "b68143e6463773b1b6c6fd009a76c32aeec041faff32ba2ed42fd7f708a17f80" } let(:sample_oid) { "b68143e6463773b1b6c6fd009a76c32aeec041faff32ba2ed42fd7f708a17f80" }
let(:sample_size) { 499013 } let(:sample_size) { 499013 }
let(:respond_with_deprecated) {[ 501, { "Content-Type"=>"application/json; charset=utf-8" }, ["{\"message\":\"Server supports batch API only, please update your Git LFS client to version 1.0.1 and up.\",\"documentation_url\":\"#{Gitlab.config.gitlab.url}/help\"}"]]} let(:respond_with_deprecated) {[ 501, { "Content-Type" => "application/json; charset=utf-8" }, ["{\"message\":\"Server supports batch API only, please update your Git LFS client to version 1.0.1 and up.\",\"documentation_url\":\"#{Gitlab.config.gitlab.url}/help\"}"]]}
let(:respond_with_disabled) {[ 501, { "Content-Type"=>"application/json; charset=utf-8" }, ["{\"message\":\"Git LFS is not enabled on this GitLab server, contact your admin.\",\"documentation_url\":\"#{Gitlab.config.gitlab.url}/help\"}"]]} let(:respond_with_disabled) {[ 501, { "Content-Type" => "application/json; charset=utf-8" }, ["{\"message\":\"Git LFS is not enabled on this GitLab server, contact your admin.\",\"documentation_url\":\"#{Gitlab.config.gitlab.url}/help\"}"]]}
describe 'when lfs is disabled' do describe 'when lfs is disabled' do
before do before do
......
...@@ -56,7 +56,7 @@ describe Commit, models: true do ...@@ -56,7 +56,7 @@ describe Commit, models: true do
end end
it "does not truncates a message with a newline after 80 but less 100 characters" do it "does not truncates a message with a newline after 80 but less 100 characters" do
message =<<eos message = <<eos
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sodales id felis id blandit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sodales id felis id blandit.
Vivamus egestas lacinia lacus, sed rutrum mauris. Vivamus egestas lacinia lacus, sed rutrum mauris.
eos eos
......
...@@ -34,14 +34,14 @@ describe ServiceHook, models: true do ...@@ -34,14 +34,14 @@ describe ServiceHook, models: true do
it "POSTs to the webhook URL" do it "POSTs to the webhook URL" do
@service_hook.execute(@data) @service_hook.execute(@data)
expect(WebMock).to have_requested(:post, @service_hook.url).with( expect(WebMock).to have_requested(:post, @service_hook.url).with(
headers: { 'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'Service Hook' } headers: { 'Content-Type' => 'application/json', 'X-Gitlab-Event' => 'Service Hook' }
).once ).once
end end
it "POSTs the data as JSON" do it "POSTs the data as JSON" do
@service_hook.execute(@data) @service_hook.execute(@data)
expect(WebMock).to have_requested(:post, @service_hook.url).with( expect(WebMock).to have_requested(:post, @service_hook.url).with(
headers: { 'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'Service Hook' } headers: { 'Content-Type' => 'application/json', 'X-Gitlab-Event' => 'Service Hook' }
).once ).once
end end
......
...@@ -33,7 +33,7 @@ describe SystemHook, models: true do ...@@ -33,7 +33,7 @@ describe SystemHook, models: true do
Projects::CreateService.new(user, name: 'empty').execute Projects::CreateService.new(user, name: 'empty').execute
expect(WebMock).to have_requested(:post, system_hook.url).with( expect(WebMock).to have_requested(:post, system_hook.url).with(
body: /project_create/, body: /project_create/,
headers: { 'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'System Hook' } headers: { 'Content-Type' => 'application/json', 'X-Gitlab-Event' => 'System Hook' }
).once ).once
end end
...@@ -42,7 +42,7 @@ describe SystemHook, models: true do ...@@ -42,7 +42,7 @@ describe SystemHook, models: true do
expect(WebMock).to have_requested(:post, system_hook.url).with( expect(WebMock).to have_requested(:post, system_hook.url).with(
body: /project_destroy/, body: /project_destroy/,
headers: { 'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'System Hook' } headers: { 'Content-Type' => 'application/json', 'X-Gitlab-Event' => 'System Hook' }
).once ).once
end end
...@@ -51,7 +51,7 @@ describe SystemHook, models: true do ...@@ -51,7 +51,7 @@ describe SystemHook, models: true do
expect(WebMock).to have_requested(:post, system_hook.url).with( expect(WebMock).to have_requested(:post, system_hook.url).with(
body: /user_create/, body: /user_create/,
headers: { 'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'System Hook' } headers: { 'Content-Type' => 'application/json', 'X-Gitlab-Event' => 'System Hook' }
).once ).once
end end
...@@ -60,7 +60,7 @@ describe SystemHook, models: true do ...@@ -60,7 +60,7 @@ describe SystemHook, models: true do
expect(WebMock).to have_requested(:post, system_hook.url).with( expect(WebMock).to have_requested(:post, system_hook.url).with(
body: /user_destroy/, body: /user_destroy/,
headers: { 'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'System Hook' } headers: { 'Content-Type' => 'application/json', 'X-Gitlab-Event' => 'System Hook' }
).once ).once
end end
...@@ -69,7 +69,7 @@ describe SystemHook, models: true do ...@@ -69,7 +69,7 @@ describe SystemHook, models: true do
expect(WebMock).to have_requested(:post, system_hook.url).with( expect(WebMock).to have_requested(:post, system_hook.url).with(
body: /user_add_to_team/, body: /user_add_to_team/,
headers: { 'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'System Hook' } headers: { 'Content-Type' => 'application/json', 'X-Gitlab-Event' => 'System Hook' }
).once ).once
end end
...@@ -79,7 +79,7 @@ describe SystemHook, models: true do ...@@ -79,7 +79,7 @@ describe SystemHook, models: true do
expect(WebMock).to have_requested(:post, system_hook.url).with( expect(WebMock).to have_requested(:post, system_hook.url).with(
body: /user_remove_from_team/, body: /user_remove_from_team/,
headers: { 'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'System Hook' } headers: { 'Content-Type' => 'application/json', 'X-Gitlab-Event' => 'System Hook' }
).once ).once
end end
...@@ -88,7 +88,7 @@ describe SystemHook, models: true do ...@@ -88,7 +88,7 @@ describe SystemHook, models: true do
expect(WebMock).to have_requested(:post, system_hook.url).with( expect(WebMock).to have_requested(:post, system_hook.url).with(
body: /group_create/, body: /group_create/,
headers: { 'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'System Hook' } headers: { 'Content-Type' => 'application/json', 'X-Gitlab-Event' => 'System Hook' }
).once ).once
end end
...@@ -97,7 +97,7 @@ describe SystemHook, models: true do ...@@ -97,7 +97,7 @@ describe SystemHook, models: true do
expect(WebMock).to have_requested(:post, system_hook.url).with( expect(WebMock).to have_requested(:post, system_hook.url).with(
body: /group_destroy/, body: /group_destroy/,
headers: { 'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'System Hook' } headers: { 'Content-Type' => 'application/json', 'X-Gitlab-Event' => 'System Hook' }
).once ).once
end end
...@@ -106,7 +106,7 @@ describe SystemHook, models: true do ...@@ -106,7 +106,7 @@ describe SystemHook, models: true do
expect(WebMock).to have_requested(:post, system_hook.url).with( expect(WebMock).to have_requested(:post, system_hook.url).with(
body: /user_add_to_group/, body: /user_add_to_group/,
headers: { 'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'System Hook' } headers: { 'Content-Type' => 'application/json', 'X-Gitlab-Event' => 'System Hook' }
).once ).once
end end
...@@ -116,7 +116,7 @@ describe SystemHook, models: true do ...@@ -116,7 +116,7 @@ describe SystemHook, models: true do
expect(WebMock).to have_requested(:post, system_hook.url).with( expect(WebMock).to have_requested(:post, system_hook.url).with(
body: /user_remove_from_group/, body: /user_remove_from_group/,
headers: { 'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'System Hook' } headers: { 'Content-Type' => 'application/json', 'X-Gitlab-Event' => 'System Hook' }
).once ).once
end end
end end
......
...@@ -106,8 +106,8 @@ describe API::API, api: true do ...@@ -106,8 +106,8 @@ describe API::API, api: true do
context 'authorized user' do context 'authorized user' do
let(:download_headers) do let(:download_headers) do
{ 'Content-Transfer-Encoding'=>'binary', { 'Content-Transfer-Encoding' => 'binary',
'Content-Disposition'=>'attachment; filename=ci_build_artifacts.zip' } 'Content-Disposition' => 'attachment; filename=ci_build_artifacts.zip' }
end end
it 'should return specific build artifacts' do it 'should return specific build artifacts' do
......
...@@ -34,11 +34,11 @@ describe API::API, api: true do ...@@ -34,11 +34,11 @@ describe API::API, api: true do
expect(response.status).to eq(200) expect(response.status).to eq(200)
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(json_response.size).to eq(5) expect(json_response.size).to eq(5)
expect(json_response.find { |e| e['id']==owner.id }['access_level']).to eq(GroupMember::OWNER) expect(json_response.find { |e| e['id'] == owner.id }['access_level']).to eq(GroupMember::OWNER)
expect(json_response.find { |e| e['id']==reporter.id }['access_level']).to eq(GroupMember::REPORTER) expect(json_response.find { |e| e['id'] == reporter.id }['access_level']).to eq(GroupMember::REPORTER)
expect(json_response.find { |e| e['id']==developer.id }['access_level']).to eq(GroupMember::DEVELOPER) expect(json_response.find { |e| e['id'] == developer.id }['access_level']).to eq(GroupMember::DEVELOPER)
expect(json_response.find { |e| e['id']==master.id }['access_level']).to eq(GroupMember::MASTER) expect(json_response.find { |e| e['id'] == master.id }['access_level']).to eq(GroupMember::MASTER)
expect(json_response.find { |e| e['id']==guest.id }['access_level']).to eq(GroupMember::GUEST) expect(json_response.find { |e| e['id'] == guest.id }['access_level']).to eq(GroupMember::GUEST)
end end
end end
......
...@@ -402,8 +402,8 @@ describe Ci::API::API do ...@@ -402,8 +402,8 @@ describe Ci::API::API do
context 'build has artifacts' do context 'build has artifacts' do
let(:build) { create(:ci_build, :artifacts) } let(:build) { create(:ci_build, :artifacts) }
let(:download_headers) do let(:download_headers) do
{ 'Content-Transfer-Encoding'=>'binary', { 'Content-Transfer-Encoding' => 'binary',
'Content-Disposition'=>'attachment; filename=ci_build_artifacts.zip' } 'Content-Disposition' => 'attachment; filename=ci_build_artifacts.zip' }
end end
it 'should download artifact' do it 'should download artifact' do
......
...@@ -2,11 +2,11 @@ module JiraServiceHelper ...@@ -2,11 +2,11 @@ module JiraServiceHelper
def jira_service_settings def jira_service_settings
properties = { properties = {
"title"=>"JIRA tracker", "title" => "JIRA tracker",
"project_url"=>"http://jira.example/issues/?jql=project=A", "project_url" => "http://jira.example/issues/?jql=project=A",
"issues_url"=>"http://jira.example/browse/JIRA-1", "issues_url" => "http://jira.example/browse/JIRA-1",
"new_issue_url"=>"http://jira.example/secure/CreateIssue.jspa", "new_issue_url" => "http://jira.example/secure/CreateIssue.jspa",
"api_url"=>"http://jira.example/rest/api/2" "api_url" => "http://jira.example/rest/api/2"
} }
jira_tracker.update_attributes(properties: properties, active: true) jira_tracker.update_attributes(properties: properties, active: true)
......
...@@ -36,20 +36,20 @@ module StubGitlabCalls ...@@ -36,20 +36,20 @@ module StubGitlabCalls
stub_request(:post, "#{gitlab_url}api/v3/session.json"). stub_request(:post, "#{gitlab_url}api/v3/session.json").
with(body: "{\"email\":\"test@test.com\",\"password\":\"123456\"}", with(body: "{\"email\":\"test@test.com\",\"password\":\"123456\"}",
headers: { 'Content-Type'=>'application/json' }). headers: { 'Content-Type' => 'application/json' }).
to_return(status: 201, body: f, headers: { 'Content-Type'=>'application/json' }) to_return(status: 201, body: f, headers: { 'Content-Type' => 'application/json' })
end end
def stub_user def stub_user
f = File.read(Rails.root.join('spec/support/gitlab_stubs/user.json')) f = File.read(Rails.root.join('spec/support/gitlab_stubs/user.json'))
stub_request(:get, "#{gitlab_url}api/v3/user?private_token=Wvjy2Krpb7y8xi93owUz"). stub_request(:get, "#{gitlab_url}api/v3/user?private_token=Wvjy2Krpb7y8xi93owUz").
with(headers: { 'Content-Type'=>'application/json' }). with(headers: { 'Content-Type' => 'application/json' }).
to_return(status: 200, body: f, headers: { 'Content-Type'=>'application/json' }) to_return(status: 200, body: f, headers: { 'Content-Type' => 'application/json' })
stub_request(:get, "#{gitlab_url}api/v3/user?access_token=some_token"). stub_request(:get, "#{gitlab_url}api/v3/user?access_token=some_token").
with(headers: { 'Content-Type'=>'application/json' }). with(headers: { 'Content-Type' => 'application/json' }).
to_return(status: 200, body: f, headers: { 'Content-Type'=>'application/json' }) to_return(status: 200, body: f, headers: { 'Content-Type' => 'application/json' })
end end
def stub_project_8 def stub_project_8
...@@ -66,19 +66,19 @@ module StubGitlabCalls ...@@ -66,19 +66,19 @@ module StubGitlabCalls
f = File.read(Rails.root.join('spec/support/gitlab_stubs/projects.json')) f = File.read(Rails.root.join('spec/support/gitlab_stubs/projects.json'))
stub_request(:get, "#{gitlab_url}api/v3/projects.json?archived=false&ci_enabled_first=true&private_token=Wvjy2Krpb7y8xi93owUz"). stub_request(:get, "#{gitlab_url}api/v3/projects.json?archived=false&ci_enabled_first=true&private_token=Wvjy2Krpb7y8xi93owUz").
with(headers: { 'Content-Type'=>'application/json' }). with(headers: { 'Content-Type' => 'application/json' }).
to_return(status: 200, body: f, headers: { 'Content-Type'=>'application/json' }) to_return(status: 200, body: f, headers: { 'Content-Type' => 'application/json' })
end end
def stub_projects_owned def stub_projects_owned
stub_request(:get, "#{gitlab_url}api/v3/projects/owned.json?archived=false&ci_enabled_first=true&private_token=Wvjy2Krpb7y8xi93owUz"). stub_request(:get, "#{gitlab_url}api/v3/projects/owned.json?archived=false&ci_enabled_first=true&private_token=Wvjy2Krpb7y8xi93owUz").
with(headers: { 'Content-Type'=>'application/json' }). with(headers: { 'Content-Type' => 'application/json' }).
to_return(status: 200, body: "", headers: {}) to_return(status: 200, body: "", headers: {})
end end
def stub_ci_enable def stub_ci_enable
stub_request(:put, "#{gitlab_url}api/v3/projects/2/services/gitlab-ci.json?private_token=Wvjy2Krpb7y8xi93owUz"). stub_request(:put, "#{gitlab_url}api/v3/projects/2/services/gitlab-ci.json?private_token=Wvjy2Krpb7y8xi93owUz").
with(headers: { 'Content-Type'=>'application/json' }). with(headers: { 'Content-Type' => 'application/json' }).
to_return(status: 200, body: "", headers: {}) to_return(status: 200, body: "", headers: {})
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