summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-06-29 19:50:08 +0000
committerRobert Speicher <robert@gitlab.com>2016-06-29 19:50:08 +0000
commit84113d7e725dcf6f9a3945853475f0cede957fec (patch)
tree95d82e602ffe0f52d2e7b579f167ffaaa55d5e9c
parent722a6c533a33265214b993122167ff5398e198ea (diff)
parent28bafd5354427d27cabe40966bd069a75984e2b1 (diff)
downloadgitlab-ce-84113d7e725dcf6f9a3945853475f0cede957fec.tar.gz
Merge branch 'rubocop/enable-space-after-cops' into 'master'
Enable Style/SpaceAfterComma and Colon Rubocop cops See #17478 See merge request !4991
-rw-r--r--.rubocop.yml4
-rw-r--r--app/controllers/ci/projects_controller.rb2
-rw-r--r--app/helpers/page_layout_helper.rb2
-rw-r--r--app/helpers/projects_helper.rb4
-rw-r--r--app/models/network/graph.rb4
-rw-r--r--app/models/project_services/hipchat_service.rb2
-rw-r--r--app/models/project_services/jira_service.rb2
-rw-r--r--app/models/user.rb2
-rw-r--r--app/uploaders/lfs_object_uploader.rb2
-rw-r--r--config/initializers/devise.rb2
-rw-r--r--config/initializers/sidekiq.rb2
-rw-r--r--config/routes.rb2
-rw-r--r--features/steps/groups.rb2
-rw-r--r--features/steps/project/forked_merge_requests.rb2
-rw-r--r--lib/api/group_members.rb2
-rw-r--r--lib/gitlab/backend/grack_auth.rb2
-rw-r--r--lib/gitlab/o_auth/auth_hash.rb2
-rw-r--r--spec/features/issues_spec.rb2
-rw-r--r--spec/features/projects/import_export/import_file_spec.rb2
-rw-r--r--spec/lib/gitlab/import_export/reader_spec.rb2
-rw-r--r--spec/lib/gitlab/o_auth/user_spec.rb4
-rw-r--r--spec/requests/api/projects_spec.rb6
22 files changed, 28 insertions, 28 deletions
diff --git a/.rubocop.yml b/.rubocop.yml
index 23ed0c82e8c..cc3055ef66e 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -534,11 +534,11 @@ Style/SingleLineMethods:
# Use spaces after colons.
Style/SpaceAfterColon:
- Enabled: false
+ Enabled: true
# Use spaces after commas.
Style/SpaceAfterComma:
- Enabled: false
+ Enabled: true
# Do not put a space between a method name and the opening parenthesis in a
# method definition.
diff --git a/app/controllers/ci/projects_controller.rb b/app/controllers/ci/projects_controller.rb
index 8bf71a1adbb..aa894fde36b 100644
--- a/app/controllers/ci/projects_controller.rb
+++ b/app/controllers/ci/projects_controller.rb
@@ -25,7 +25,7 @@ module Ci
return render_404 unless @project
image = Ci::ImageForBuildService.new.execute(@project, params)
- send_file image.path, filename: image.name, disposition: 'inline', type:"image/svg+xml"
+ send_file image.path, filename: image.name, disposition: 'inline', type: "image/svg+xml"
end
protected
diff --git a/app/helpers/page_layout_helper.rb b/app/helpers/page_layout_helper.rb
index e4e8b934bc8..22387d66451 100644
--- a/app/helpers/page_layout_helper.rb
+++ b/app/helpers/page_layout_helper.rb
@@ -52,7 +52,7 @@ module PageLayoutHelper
raise ArgumentError, 'cannot provide more than two attributes' if map.length > 2
@page_card_attributes ||= {}
- @page_card_attributes = map.reject { |_,v| v.blank? } if map.present?
+ @page_card_attributes = map.reject { |_, v| v.blank? } if map.present?
@page_card_attributes
end
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index d91e3332e48..26796b08fac 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -15,7 +15,7 @@ module ProjectsHelper
def link_to_member_avatar(author, opts = {})
default_opts = { avatar: true, name: true, size: 16, author_class: 'author', title: ":name" }
opts = default_opts.merge(opts)
- image_tag(avatar_icon(author, opts[:size]), width: opts[:size], class: "avatar avatar-inline #{"s#{opts[:size]}" if opts[:size]}", alt:'') if opts[:avatar]
+ image_tag(avatar_icon(author, opts[:size]), width: opts[:size], class: "avatar avatar-inline #{"s#{opts[:size]}" if opts[:size]}", alt: '') if opts[:avatar]
end
def link_to_member(project, author, opts = {}, &block)
@@ -27,7 +27,7 @@ module ProjectsHelper
author_html = ""
# Build avatar image tag
- author_html << image_tag(avatar_icon(author, opts[:size]), width: opts[:size], class: "avatar avatar-inline #{"s#{opts[:size]}" if opts[:size]}", alt:'') if opts[:avatar]
+ author_html << image_tag(avatar_icon(author, opts[:size]), width: opts[:size], class: "avatar avatar-inline #{"s#{opts[:size]}" if opts[:size]}", alt: '') if opts[:avatar]
# Build name span tag
if opts[:by_username]
diff --git a/app/models/network/graph.rb b/app/models/network/graph.rb
index a2aee2f925b..345041a6ad1 100644
--- a/app/models/network/graph.rb
+++ b/app/models/network/graph.rb
@@ -54,7 +54,7 @@ module Network
@map = {}
@reserved = {}
- @commits.each_with_index do |c,i|
+ @commits.each_with_index do |c, i|
c.time = i
days[i] = c.committed_date
@map[c.id] = c
@@ -116,7 +116,7 @@ module Network
end
def commits_sort_by_ref
- @commits.sort do |a,b|
+ @commits.sort do |a, b|
if include_ref?(a)
-1
elsif include_ref?(b)
diff --git a/app/models/project_services/hipchat_service.rb b/app/models/project_services/hipchat_service.rb
index 0ff4f4c8dd2..23e5b16221b 100644
--- a/app/models/project_services/hipchat_service.rb
+++ b/app/models/project_services/hipchat_service.rb
@@ -106,7 +106,7 @@ class HipchatService < Service
else
message << "pushed to #{ref_type} <a href=\""\
"#{project.web_url}/commits/#{CGI.escape(ref)}\">#{ref}</a> "
- message << "of <a href=\"#{project.web_url}\">#{project.name_with_namespace.gsub!(/\s/,'')}</a> "
+ message << "of <a href=\"#{project.web_url}\">#{project.name_with_namespace.gsub!(/\s/, '')}</a> "
message << "(<a href=\"#{project.web_url}/compare/#{before}...#{after}\">Compare changes</a>)"
push[:commits].take(MAX_COMMITS).each do |commit|
diff --git a/app/models/project_services/jira_service.rb b/app/models/project_services/jira_service.rb
index beda89d3963..8b3296c712f 100644
--- a/app/models/project_services/jira_service.rb
+++ b/app/models/project_services/jira_service.rb
@@ -124,7 +124,7 @@ class JiraService < IssueTrackerService
def build_api_url_from_project_url
server = URI(project_url)
- default_ports = [["http",80],["https",443]].include?([server.scheme,server.port])
+ default_ports = [["http", 80], ["https", 443]].include?([server.scheme, server.port])
server_url = "#{server.scheme}://#{server.host}"
server_url.concat(":#{server.port}") unless default_ports
"#{server_url}/rest/api/#{DEFAULT_API_VERSION}"
diff --git a/app/models/user.rb b/app/models/user.rb
index 767d6366c79..eac716b120b 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -764,7 +764,7 @@ class User < ActiveRecord::Base
unless email_domains.blank?
match_found = email_domains.any? do |domain|
- escaped = Regexp.escape(domain).gsub('\*','.*?')
+ escaped = Regexp.escape(domain).gsub('\*', '.*?')
regexp = Regexp.new "^#{escaped}$", Regexp::IGNORECASE
email_domain = Mail::Address.new(self.email).domain
email_domain =~ regexp
diff --git a/app/uploaders/lfs_object_uploader.rb b/app/uploaders/lfs_object_uploader.rb
index 28085b31083..046a1d641a9 100644
--- a/app/uploaders/lfs_object_uploader.rb
+++ b/app/uploaders/lfs_object_uploader.rb
@@ -4,7 +4,7 @@ class LfsObjectUploader < CarrierWave::Uploader::Base
storage :file
def store_dir
- "#{Gitlab.config.lfs.storage_path}/#{model.oid[0,2]}/#{model.oid[2,2]}"
+ "#{Gitlab.config.lfs.storage_path}/#{model.oid[0, 2]}/#{model.oid[2, 2]}"
end
def cache_dir
diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb
index 021bdb11251..73977341b73 100644
--- a/config/initializers/devise.rb
+++ b/config/initializers/devise.rb
@@ -212,7 +212,7 @@ Devise.setup do |config|
if Gitlab::LDAP::Config.enabled?
Gitlab.config.ldap.servers.values.each do |server|
if server['allow_username_or_email_login']
- email_stripping_proc = ->(name) {name.gsub(/@.*\z/,'')}
+ email_stripping_proc = ->(name) {name.gsub(/@.*\z/, '')}
else
email_stripping_proc = ->(name) {name}
end
diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb
index 7a2b9a7f6c1..593c14a289f 100644
--- a/config/initializers/sidekiq.rb
+++ b/config/initializers/sidekiq.rb
@@ -13,7 +13,7 @@ Sidekiq.configure_server do |config|
# UGLY Hack to get nested hash from settingslogic
cron_jobs = JSON.parse(Gitlab.config.cron_jobs.to_json)
# UGLY hack: Settingslogic doesn't allow 'class' key
- cron_jobs.each { |k,v| cron_jobs[k]['class'] = cron_jobs[k].delete('job_class') }
+ cron_jobs.each { |k, v| cron_jobs[k]['class'] = cron_jobs[k].delete('job_class') }
Sidekiq::Cron::Job.load_from_hash! cron_jobs
# Database pool should be at least `sidekiq_concurrency` + 2
diff --git a/config/routes.rb b/config/routes.rb
index bdfb16a66bf..2aab73720f2 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -653,7 +653,7 @@ Rails.application.routes.draw do
get '/wikis/*id', to: 'wikis#show', as: 'wiki', constraints: WIKI_SLUG_ID
delete '/wikis/*id', to: 'wikis#destroy', constraints: WIKI_SLUG_ID
put '/wikis/*id', to: 'wikis#update', constraints: WIKI_SLUG_ID
- post '/wikis/*id/markdown_preview', to:'wikis#markdown_preview', constraints: WIKI_SLUG_ID, as: 'wiki_markdown_preview'
+ post '/wikis/*id/markdown_preview', to: 'wikis#markdown_preview', constraints: WIKI_SLUG_ID, as: 'wiki_markdown_preview'
end
resource :repository, only: [:show, :create] do
diff --git a/features/steps/groups.rb b/features/steps/groups.rb
index 483370f41c6..4fa7d7c6567 100644
--- a/features/steps/groups.rb
+++ b/features/steps/groups.rb
@@ -93,7 +93,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
step 'I should see new group "Owned" avatar' do
expect(owned_group.avatar).to be_instance_of AvatarUploader
- expect(owned_group.avatar.url).to eq "/uploads/group/avatar/#{Group.find_by(name:"Owned").id}/banana_sample.gif"
+ expect(owned_group.avatar.url).to eq "/uploads/group/avatar/#{Group.find_by(name: "Owned").id}/banana_sample.gif"
end
step 'I should see the "Remove avatar" button' do
diff --git a/features/steps/project/forked_merge_requests.rb b/features/steps/project/forked_merge_requests.rb
index 0ead83d6937..6b56a77b832 100644
--- a/features/steps/project/forked_merge_requests.rb
+++ b/features/steps/project/forked_merge_requests.rb
@@ -153,6 +153,6 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps
# Verify a link is generated against the correct project
def verify_commit_link(container_div, container_project)
# This should force a wait for the javascript to execute
- expect(find(:div,container_div).find(".commit_short_id")['href']).to have_content "#{container_project.path_with_namespace}/commit"
+ expect(find(:div, container_div).find(".commit_short_id")['href']).to have_content "#{container_project.path_with_namespace}/commit"
end
end
diff --git a/lib/api/group_members.rb b/lib/api/group_members.rb
index ab9b7c602b5..dbe5bb08d3f 100644
--- a/lib/api/group_members.rb
+++ b/lib/api/group_members.rb
@@ -77,7 +77,7 @@ module API
member = group.group_members.find_by(user_id: params[:user_id])
if member.nil?
- render_api_error!("404 Not Found - user_id:#{params[:user_id]} not a member of group #{group.name}",404)
+ render_api_error!("404 Not Found - user_id:#{params[:user_id]} not a member of group #{group.name}", 404)
else
member.destroy
end
diff --git a/lib/gitlab/backend/grack_auth.rb b/lib/gitlab/backend/grack_auth.rb
index ab7b811c5d8..ad412f56cca 100644
--- a/lib/gitlab/backend/grack_auth.rb
+++ b/lib/gitlab/backend/grack_auth.rb
@@ -22,7 +22,7 @@ module Grack
# Need this if under RELATIVE_URL_ROOT
unless Gitlab.config.gitlab.relative_url_root.empty?
# If website is mounted using relative_url_root need to remove it first
- @env['PATH_INFO'] = @request.path.sub(Gitlab.config.gitlab.relative_url_root,'')
+ @env['PATH_INFO'] = @request.path.sub(Gitlab.config.gitlab.relative_url_root, '')
else
@env['PATH_INFO'] = @request.path
end
diff --git a/lib/gitlab/o_auth/auth_hash.rb b/lib/gitlab/o_auth/auth_hash.rb
index 36e5c2670bb..7d6911a1ab3 100644
--- a/lib/gitlab/o_auth/auth_hash.rb
+++ b/lib/gitlab/o_auth/auth_hash.rb
@@ -66,7 +66,7 @@ module Gitlab
# Get the first part of the email address (before @)
# In addtion in removes illegal characters
def generate_username(email)
- email.match(/^[^@]*/)[0].mb_chars.normalize(:kd).gsub(/[^\x00-\x7F]/,'').to_s
+ email.match(/^[^@]*/)[0].mb_chars.normalize(:kd).gsub(/[^\x00-\x7F]/, '').to_s
end
def generate_temporarily_email(username)
diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb
index 5065dfb849c..17df66e73b4 100644
--- a/spec/features/issues_spec.rb
+++ b/spec/features/issues_spec.rb
@@ -92,7 +92,7 @@ describe 'Issues', feature: true do
end
context 'on edit form' do
- let(:issue) { create(:issue, author: @user,project: project, due_date: Date.today.at_beginning_of_month.to_s) }
+ let(:issue) { create(:issue, author: @user, project: project, due_date: Date.today.at_beginning_of_month.to_s) }
before do
visit edit_namespace_project_issue_path(project.namespace, project, issue)
diff --git a/spec/features/projects/import_export/import_file_spec.rb b/spec/features/projects/import_export/import_file_spec.rb
index c5fb0fc783b..9d66f76ef58 100644
--- a/spec/features/projects/import_export/import_file_spec.rb
+++ b/spec/features/projects/import_export/import_file_spec.rb
@@ -24,7 +24,7 @@ feature 'project import', feature: true, js: true do
visit new_project_path
select2('2', from: '#project_namespace_id')
- fill_in :project_path, with:'test-project-path', visible: true
+ fill_in :project_path, with: 'test-project-path', visible: true
click_link 'GitLab export'
expect(page).to have_content('GitLab project export')
diff --git a/spec/lib/gitlab/import_export/reader_spec.rb b/spec/lib/gitlab/import_export/reader_spec.rb
index 109522fa626..211ef68dfab 100644
--- a/spec/lib/gitlab/import_export/reader_spec.rb
+++ b/spec/lib/gitlab/import_export/reader_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Gitlab::ImportExport::Reader, lib: true do
- let(:shared) { Gitlab::ImportExport::Shared.new(relative_path:'') }
+ let(:shared) { Gitlab::ImportExport::Shared.new(relative_path: '') }
let(:test_config) { 'spec/support/import_export/import_export.yml' }
let(:project_tree_hash) do
{
diff --git a/spec/lib/gitlab/o_auth/user_spec.rb b/spec/lib/gitlab/o_auth/user_spec.rb
index 6727a83e58a..5ec5ab40b6f 100644
--- a/spec/lib/gitlab/o_auth/user_spec.rb
+++ b/spec/lib/gitlab/o_auth/user_spec.rb
@@ -122,7 +122,7 @@ describe Gitlab::OAuth::User, lib: true do
before do
allow(ldap_user).to receive(:uid) { uid }
allow(ldap_user).to receive(:username) { uid }
- allow(ldap_user).to receive(:email) { ['johndoe@example.com','john2@example.com'] }
+ allow(ldap_user).to receive(:email) { ['johndoe@example.com', 'john2@example.com'] }
allow(ldap_user).to receive(:dn) { 'uid=user1,ou=People,dc=example' }
allow(Gitlab::LDAP::Person).to receive(:find_by_uid).and_return(ldap_user)
end
@@ -203,7 +203,7 @@ describe Gitlab::OAuth::User, lib: true do
stub_omniauth_config(auto_link_ldap_user: true)
allow(ldap_user).to receive(:uid) { uid }
allow(ldap_user).to receive(:username) { uid }
- allow(ldap_user).to receive(:email) { ['johndoe@example.com','john2@example.com'] }
+ allow(ldap_user).to receive(:email) { ['johndoe@example.com', 'john2@example.com'] }
allow(ldap_user).to receive(:dn) { 'uid=user1,ou=People,dc=example' }
allow(oauth_user).to receive(:ldap_person).and_return(ldap_user)
end
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb
index 41b5ed9bc33..5c909d8b3b3 100644
--- a/spec/requests/api/projects_spec.rb
+++ b/spec/requests/api/projects_spec.rb
@@ -217,7 +217,7 @@ describe API::API, api: true do
post api('/projects', user), project
- project.each_pair do |k,v|
+ project.each_pair do |k, v|
expect(json_response[k.to_s]).to eq(v)
end
end
@@ -325,7 +325,7 @@ describe API::API, api: true do
post api("/projects/user/#{user.id}", admin), project
- project.each_pair do |k,v|
+ project.each_pair do |k, v|
next if k == :path
expect(json_response[k.to_s]).to eq(v)
end
@@ -805,7 +805,7 @@ describe API::API, api: true do
context 'when authenticated' do
it 'should return an array of projects' do
- get api("/projects/search/#{query}",user)
+ get api("/projects/search/#{query}", user)
expect(response).to have_http_status(200)
expect(json_response).to be_an Array
expect(json_response.size).to eq(6)