Skip to content
Snippets Groups Projects
Verified Commit c946ee12 authored by Rémy Coutable's avatar Rémy Coutable
Browse files

Enable the Layout/SpaceBeforeBlockBraces cop


Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 932a6e69
No related branches found
No related tags found
No related merge requests found
Showing
with 39 additions and 39 deletions
Loading
Loading
@@ -207,6 +207,13 @@ Layout/SpaceAroundKeyword:
Layout/SpaceAroundOperators:
Enabled: true
 
# Checks that block braces have or don't have a space before the opening
# brace depending on configuration.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: space, no_space
Layout/SpaceBeforeBlockBraces:
Enabled: true
# No spaces before commas.
Layout/SpaceBeforeComma:
Enabled: true
Loading
Loading
Loading
Loading
@@ -26,13 +26,6 @@ Layout/IndentArray:
Layout/IndentHash:
Enabled: false
 
# Offense count: 174
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: space, no_space
Layout/SpaceBeforeBlockBraces:
Enabled: false
# Offense count: 8
# Cop supports --auto-correct.
# Configuration parameters: AllowForAlignment.
Loading
Loading
Loading
Loading
@@ -117,7 +117,7 @@ class ApplicationController < ActionController::Base
Raven.capture_exception(exception) if sentry_enabled?
 
application_trace = ActionDispatch::ExceptionWrapper.new(env, exception).application_trace
application_trace.map!{ |t| " #{t}\n" }
application_trace.map! { |t| " #{t}\n" }
logger.error "\n#{exception.class.name} (#{exception.message}):\n#{application_trace.join}"
end
 
Loading
Loading
Loading
Loading
@@ -15,7 +15,7 @@ class Import::GitlabController < Import::BaseController
@already_added_projects = current_user.created_projects.where(import_type: "gitlab")
already_added_projects_names = @already_added_projects.pluck(:import_source)
 
@repos = @repos.to_a.reject{ |repo| already_added_projects_names.include? repo["path_with_namespace"] }
@repos = @repos.to_a.reject { |repo| already_added_projects_names.include? repo["path_with_namespace"] }
end
 
def jobs
Loading
Loading
Loading
Loading
@@ -3,7 +3,7 @@ module GraphHelper
refs = ""
# Commit::ref_names already strips the refs/XXX from important refs (e.g. refs/heads/XXX)
# so anything leftover is internally used by GitLab
commit_refs = commit.ref_names(repo).reject{ |name| name.starts_with?('refs/') }
commit_refs = commit.ref_names(repo).reject { |name| name.starts_with?('refs/') }
refs << commit_refs.join(' ')
 
# append note count
Loading
Loading
Loading
Loading
@@ -151,7 +151,7 @@ module IssuablesHelper
end
 
def issuable_labels_tooltip(labels, limit: 5)
first, last = labels.partition.with_index{ |_, i| i < limit }
first, last = labels.partition.with_index { |_, i| i < limit }
 
label_names = first.collect(&:name)
label_names << "and #{last.size} more" unless last.empty?
Loading
Loading
@@ -329,7 +329,7 @@ module IssuablesHelper
end
 
def selected_template(issuable)
params[:issuable_template] if issuable_templates(issuable).any?{ |template| template[:name] == params[:issuable_template] }
params[:issuable_template] if issuable_templates(issuable).any? { |template| template[:name] == params[:issuable_template] }
end
 
def issuable_todo_button_data(issuable, todo, is_collapsed)
Loading
Loading
Loading
Loading
@@ -206,7 +206,7 @@ module Network
 
# Visit branching chains
leaves.each do |l|
parents = l.parents(@map).select{|p| p.space.zero?}
parents = l.parents(@map).select {|p| p.space.zero?}
parents.each do |p|
place_chain(p, l.time)
end
Loading
Loading
Loading
Loading
@@ -77,20 +77,20 @@ class Note < ActiveRecord::Base
 
# Scopes
scope :for_commit_id, ->(commit_id) { where(noteable_type: "Commit", commit_id: commit_id) }
scope :system, ->{ where(system: true) }
scope :user, ->{ where(system: false) }
scope :common, ->{ where(noteable_type: ["", nil]) }
scope :fresh, ->{ order(created_at: :asc, id: :asc) }
scope :updated_after, ->(time){ where('updated_at > ?', time) }
scope :inc_author_project, ->{ includes(:project, :author) }
scope :inc_author, ->{ includes(:author) }
scope :system, -> { where(system: true) }
scope :user, -> { where(system: false) }
scope :common, -> { where(noteable_type: ["", nil]) }
scope :fresh, -> { order(created_at: :asc, id: :asc) }
scope :updated_after, ->(time) { where('updated_at > ?', time) }
scope :inc_author_project, -> { includes(:project, :author) }
scope :inc_author, -> { includes(:author) }
scope :inc_relations_for_view, -> do
includes(:project, :author, :updated_by, :resolved_by, :award_emoji, :system_note_metadata)
end
 
scope :diff_notes, ->{ where(type: %w(LegacyDiffNote DiffNote)) }
scope :new_diff_notes, ->{ where(type: 'DiffNote') }
scope :non_diff_notes, ->{ where(type: ['Note', 'DiscussionNote', nil]) }
scope :diff_notes, -> { where(type: %w(LegacyDiffNote DiffNote)) }
scope :new_diff_notes, -> { where(type: 'DiffNote') }
scope :non_diff_notes, -> { where(type: ['Note', 'DiscussionNote', nil]) }
 
scope :with_associations, -> do
# FYI noteable cannot be loaded for LegacyDiffNote for commits
Loading
Loading
Loading
Loading
@@ -71,7 +71,7 @@ class Settings < Settingslogic
 
# check that `current` (string or integer) is a contant in `modul`.
def verify_constant(modul, current, default)
constant = modul.constants.find{ |name| modul.const_get(name) == current }
constant = modul.constants.find { |name| modul.const_get(name) == current }
value = constant.nil? ? default : modul.const_get(constant)
if current.is_a? String
value = modul.const_get(current.upcase) rescue default
Loading
Loading
Loading
Loading
@@ -10,7 +10,7 @@ class AddUniqueIndexToLabels < ActiveRecord::Migration
def up
select_all('SELECT title, project_id, COUNT(id) as cnt FROM labels GROUP BY project_id, title HAVING COUNT(id) > 1').each do |label|
label_title = quote_string(label['title'])
duplicated_ids = select_all("SELECT id FROM labels WHERE project_id = #{label['project_id']} AND title = '#{label_title}' ORDER BY id ASC").map{ |label| label['id'] }
duplicated_ids = select_all("SELECT id FROM labels WHERE project_id = #{label['project_id']} AND title = '#{label_title}' ORDER BY id ASC").map { |label| label['id'] }
label_id = duplicated_ids.first
duplicated_ids.delete(label_id)
 
Loading
Loading
Loading
Loading
@@ -30,7 +30,7 @@ class CleanupNamespacelessPendingDeleteProjects < ActiveRecord::Migration
private
 
def pending_delete_batch
connection.exec_query(find_batch).map{ |row| row['id'].to_i }
connection.exec_query(find_batch).map { |row| row['id'].to_i }
end
 
BATCH_SIZE = 5000
Loading
Loading
Loading
Loading
@@ -132,7 +132,7 @@ module API
expose :lfs_enabled?, as: :lfs_enabled
expose :creator_id
expose :namespace, using: 'API::Entities::Namespace'
expose :forked_from_project, using: Entities::BasicProjectDetails, if: lambda{ |project, options| project.forked? }
expose :forked_from_project, using: Entities::BasicProjectDetails, if: lambda { |project, options| project.forked? }
expose :import_status
expose :import_error, if: lambda { |_project, options| options[:user_can_admin_project] }
expose :avatar_url do |user, options|
Loading
Loading
Loading
Loading
@@ -68,7 +68,7 @@ module API
expose :lfs_enabled?, as: :lfs_enabled
expose :creator_id
expose :namespace, using: 'API::Entities::Namespace'
expose :forked_from_project, using: ::API::Entities::BasicProjectDetails, if: lambda{ |project, options| project.forked? }
expose :forked_from_project, using: ::API::Entities::BasicProjectDetails, if: lambda { |project, options| project.forked? }
expose :avatar_url do |user, options|
user.avatar_url(only_path: false)
end
Loading
Loading
Loading
Loading
@@ -198,11 +198,11 @@ module Backup
end
 
def archives_to_backup
ARCHIVES_TO_BACKUP.map{ |name| (name + ".tar.gz") unless skipped?(name) }.compact
ARCHIVES_TO_BACKUP.map { |name| (name + ".tar.gz") unless skipped?(name) }.compact
end
 
def folders_to_backup
FOLDERS_TO_BACKUP.reject{ |name| skipped?(name) }
FOLDERS_TO_BACKUP.reject { |name| skipped?(name) }
end
 
def disabled_features
Loading
Loading
Loading
Loading
@@ -71,7 +71,7 @@ module Gitlab
end
 
def config
Gitlab.config.omniauth.providers.find{|provider| provider.name == "gitlab"}
Gitlab.config.omniauth.providers.find {|provider| provider.name == "gitlab"}
end
 
def gitlab_options
Loading
Loading
Loading
Loading
@@ -127,7 +127,7 @@ describe Admin::UsersController do
 
describe 'POST create' do
it 'creates the user' do
expect{ post :create, user: attributes_for(:user) }.to change{ User.count }.by(1)
expect { post :create, user: attributes_for(:user) }.to change { User.count }.by(1)
end
 
it 'shows only one error message for an invalid email' do
Loading
Loading
Loading
Loading
@@ -24,7 +24,7 @@ describe InvitesController do
describe 'GET #decline' do
it 'declines user' do
get :decline, id: token
expect{member.reload}.to raise_error ActiveRecord::RecordNotFound
expect {member.reload}.to raise_error ActiveRecord::RecordNotFound
 
expect(response).to have_http_status(302)
expect(flash[:notice]).to include 'You have declined the invitation to join'
Loading
Loading
Loading
Loading
@@ -292,13 +292,13 @@ describe Projects::IssuesController do
 
it 'rejects an issue recognized as a spam' do
expect(Gitlab::Recaptcha).to receive(:load_configurations!).and_return(true)
expect { update_spam_issue }.not_to change{ issue.reload.title }
expect { update_spam_issue }.not_to change { issue.reload.title }
end
 
it 'rejects an issue recognized as a spam when recaptcha disabled' do
stub_application_setting(recaptcha_enabled: false)
 
expect { update_spam_issue }.not_to change{ issue.reload.title }
expect { update_spam_issue }.not_to change { issue.reload.title }
end
 
it 'creates a spam log' do
Loading
Loading
@@ -358,7 +358,7 @@ describe Projects::IssuesController do
end
 
it 'accepts an issue after recaptcha is verified' do
expect{ update_verified_issue }.to change{ issue.reload.title }.to(spammy_title)
expect { update_verified_issue }.to change { issue.reload.title }.to(spammy_title)
end
 
it 'marks spam log as recaptcha_verified' do
Loading
Loading
Loading
Loading
@@ -67,7 +67,7 @@ describe Projects::TodosController do
end
 
it "doesn't create todo" do
expect{ go }.not_to change { user.todos.count }
expect { go }.not_to change { user.todos.count }
expect(response).to have_http_status(404)
end
end
Loading
Loading
@@ -135,7 +135,7 @@ describe Projects::TodosController do
end
 
it "doesn't create todo" do
expect{ go }.not_to change { user.todos.count }
expect { go }.not_to change { user.todos.count }
expect(response).to have_http_status(404)
end
end
Loading
Loading
Loading
Loading
@@ -15,7 +15,7 @@ describe RegistrationsController do
it 'signs the user in' do
allow_any_instance_of(ApplicationSetting).to receive(:send_user_confirmation_email).and_return(false)
 
expect { post(:create, user_params) }.not_to change{ ActionMailer::Base.deliveries.size }
expect { post(:create, user_params) }.not_to change { ActionMailer::Base.deliveries.size }
expect(subject.current_user).not_to be_nil
end
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment