diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-08-08 17:46:45 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-08-08 17:46:45 +0000 |
commit | d668b145a1b2619e60586b6009390949fb363250 (patch) | |
tree | ecbff2837616f91c9a912a0aa61ba591a3a41c37 | |
parent | 8bce4a3fde12435ad50e5c8f0c43c238cdee3e24 (diff) | |
parent | c9aa19881cf719baaea1bbb9bb00f84145a99b8b (diff) | |
download | gitlab-ce-d668b145a1b2619e60586b6009390949fb363250.tar.gz |
Merge branch 'rubocop/SpaceAroundEqualsInParameterDefault' into 'master'
Enable Style/SpaceAroundEqualsInParameterDefault cop
## What does this MR do?
Enable a new rubocop cops as discussed here: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/1877#note_13529646
## Are there points in the code the reviewer needs to double check?
May be a good idea to send a message to people to prevent master red because of the new cop.
## Why was this MR needed?
We want to improve code style and not waste endbosses time checking style manually
## What are the relevant issue numbers?
## Screenshots (if relevant)
## Does this MR meet the acceptance criteria?
- [ ] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)
- [ ] API support added
- Tests
- [ ] Added for this feature/bug
- [ ] All builds are passing
- [ ] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [ ] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)
See merge request !5693
-rw-r--r-- | .rubocop.yml | 4 | ||||
-rw-r--r-- | .rubocop_todo.yml | 7 | ||||
-rw-r--r-- | app/controllers/registrations_controller.rb | 2 | ||||
-rw-r--r-- | app/helpers/explore_helper.rb | 2 | ||||
-rw-r--r-- | app/helpers/search_helper.rb | 2 | ||||
-rw-r--r-- | app/models/merge_request_diff.rb | 2 | ||||
-rw-r--r-- | app/models/repository.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/ldap/access.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/ldap/adapter.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/popen.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/redis.rb | 2 | ||||
-rw-r--r-- | spec/requests/git_http_spec.rb | 8 | ||||
-rw-r--r-- | spec/support/select2_helper.rb | 2 |
13 files changed, 18 insertions, 21 deletions
diff --git a/.rubocop.yml b/.rubocop.yml index 556a5d11a39..01976bfbe04 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -373,6 +373,10 @@ Style/SpaceAfterNot: Style/SpaceAfterSemicolon: Enabled: true +# Use space around equals in parameter default +Style/SpaceAroundEqualsInParameterDefault: + Enabled: true + # Use a space around keywords if appropriate. Style/SpaceAroundKeyword: Enabled: true diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 76ae5952753..20daf1619a7 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -339,13 +339,6 @@ Style/SingleLineBlockParams: Style/SingleLineMethods: Enabled: false -# Offense count: 14 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, SupportedStyles. -# SupportedStyles: space, no_space -Style/SpaceAroundEqualsInParameterDefault: - Enabled: false - # Offense count: 119 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, SupportedStyles. diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index 75b78a49eab..3327f4f2b87 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -33,7 +33,7 @@ class RegistrationsController < Devise::RegistrationsController protected - def build_resource(hash=nil) + def build_resource(hash = nil) super end diff --git a/app/helpers/explore_helper.rb b/app/helpers/explore_helper.rb index 337b0aacbb5..2b1f3825adc 100644 --- a/app/helpers/explore_helper.rb +++ b/app/helpers/explore_helper.rb @@ -1,5 +1,5 @@ module ExploreHelper - def filter_projects_path(options={}) + def filter_projects_path(options = {}) exist_opts = { sort: params[:sort], scope: params[:scope], diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb index a2bba139c17..c0195713f4a 100644 --- a/app/helpers/search_helper.rb +++ b/app/helpers/search_helper.rb @@ -107,7 +107,7 @@ module SearchHelper Sanitize.clean(str) end - def search_filter_path(options={}) + def search_filter_path(options = {}) exist_opts = { search: params[:search], project_id: params[:project_id], diff --git a/app/models/merge_request_diff.rb b/app/models/merge_request_diff.rb index fa0efe2d596..32cc6a3bfea 100644 --- a/app/models/merge_request_diff.rb +++ b/app/models/merge_request_diff.rb @@ -36,7 +36,7 @@ class MergeRequestDiff < ActiveRecord::Base real_size.presence || raw_diffs.size end - def raw_diffs(options={}) + def raw_diffs(options = {}) if options[:ignore_whitespace_change] @raw_diffs_no_whitespace ||= begin compare = Gitlab::Git::Compare.new( diff --git a/app/models/repository.rb b/app/models/repository.rb index c1170c470ea..701f867f67c 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -601,7 +601,7 @@ class Repository commit(sha) end - def next_branch(name, opts={}) + def next_branch(name, opts = {}) branch_ids = self.branch_names.map do |n| next 1 if n == name result = n.match(/\A#{name}-([0-9]+)\z/) diff --git a/lib/gitlab/ldap/access.rb b/lib/gitlab/ldap/access.rb index f2b649e50a2..2f326d00a2f 100644 --- a/lib/gitlab/ldap/access.rb +++ b/lib/gitlab/ldap/access.rb @@ -25,7 +25,7 @@ module Gitlab end end - def initialize(user, adapter=nil) + def initialize(user, adapter = nil) @adapter = adapter @user = user @provider = user.ldap_identity.provider diff --git a/lib/gitlab/ldap/adapter.rb b/lib/gitlab/ldap/adapter.rb index df65179bfea..9a5bcfb5c9b 100644 --- a/lib/gitlab/ldap/adapter.rb +++ b/lib/gitlab/ldap/adapter.rb @@ -13,7 +13,7 @@ module Gitlab Gitlab::LDAP::Config.new(provider) end - def initialize(provider, ldap=nil) + def initialize(provider, ldap = nil) @provider = provider @ldap = ldap || Net::LDAP.new(config.adapter_options) end diff --git a/lib/gitlab/popen.rb b/lib/gitlab/popen.rb index 43e07e09160..ca23ccef25b 100644 --- a/lib/gitlab/popen.rb +++ b/lib/gitlab/popen.rb @@ -5,7 +5,7 @@ module Gitlab module Popen extend self - def popen(cmd, path=nil) + def popen(cmd, path = nil) unless cmd.is_a?(Array) raise "System commands must be given as an array of strings" end diff --git a/lib/gitlab/redis.rb b/lib/gitlab/redis.rb index 40766f35f77..1f92986ec9a 100644 --- a/lib/gitlab/redis.rb +++ b/lib/gitlab/redis.rb @@ -37,7 +37,7 @@ module Gitlab redis_config_hash end - def initialize(rails_env=nil) + def initialize(rails_env = nil) rails_env ||= Rails.env config_file = File.expand_path('../../../config/resque.yml', __FILE__) diff --git a/spec/requests/git_http_spec.rb b/spec/requests/git_http_spec.rb index 82ab582beac..022781d8696 100644 --- a/spec/requests/git_http_spec.rb +++ b/spec/requests/git_http_spec.rb @@ -349,19 +349,19 @@ describe 'Git HTTP requests', lib: true do end end - def clone_get(project, options={}) + def clone_get(project, options = {}) get "/#{project}/info/refs", { service: 'git-upload-pack' }, auth_env(*options.values_at(:user, :password, :spnego_request_token)) end - def clone_post(project, options={}) + def clone_post(project, options = {}) post "/#{project}/git-upload-pack", {}, auth_env(*options.values_at(:user, :password, :spnego_request_token)) end - def push_get(project, options={}) + def push_get(project, options = {}) get "/#{project}/info/refs", { service: 'git-receive-pack' }, auth_env(*options.values_at(:user, :password, :spnego_request_token)) end - def push_post(project, options={}) + def push_post(project, options = {}) post "/#{project}/git-receive-pack", {}, auth_env(*options.values_at(:user, :password, :spnego_request_token)) end diff --git a/spec/support/select2_helper.rb b/spec/support/select2_helper.rb index 04d25b5e9e9..35cc51725c6 100644 --- a/spec/support/select2_helper.rb +++ b/spec/support/select2_helper.rb @@ -11,7 +11,7 @@ # module Select2Helper - def select2(value, options={}) + def select2(value, options = {}) raise ArgumentError, 'options must be a Hash' unless options.kind_of?(Hash) selector = options.fetch(:from) |