Skip to content
Snippets Groups Projects
Commit 181cd299 authored by Jacopo's avatar Jacopo
Browse files

Adds Rubocop rule for line break after guard clause

Adds a rubocop rule (with autocorrect) to ensure line break after guard clauses.
parent f2997af4
No related branches found
No related tags found
No related merge requests found
Showing
with 23 additions and 0 deletions
Loading
Loading
@@ -97,6 +97,7 @@ class ApplicationController < ActionController::Base
# (e.g. tokens) to authenticate the user, whereas Devise sets current_user
def auth_user
return current_user if current_user.present?
return try(:authenticated_user)
end
 
Loading
Loading
Loading
Loading
@@ -44,6 +44,7 @@ class AutocompleteController < ApplicationController
if @project.blank? && params[:group_id].present?
group = Group.find(params[:group_id])
return render_404 unless can?(current_user, :read_group, group)
group
end
end
Loading
Loading
@@ -54,6 +55,7 @@ class AutocompleteController < ApplicationController
if params[:project_id].present?
project = Project.find(params[:project_id])
return render_404 unless can?(current_user, :read_project, project)
project
end
end
Loading
Loading
Loading
Loading
@@ -4,6 +4,7 @@ class Import::GitlabProjectsController < Import::BaseController
def new
@namespace = Namespace.find(project_params[:namespace_id])
return render_404 unless current_user.can?(:create_projects, @namespace)
@path = project_params[:path]
end
 
Loading
Loading
Loading
Loading
@@ -12,6 +12,7 @@ class Projects::DeploymentsController < Projects::ApplicationController
 
def metrics
return render_404 unless deployment.has_metrics?
@metrics = deployment.metrics
if @metrics&.any?
render json: @metrics, status: :ok
Loading
Loading
Loading
Loading
@@ -12,6 +12,7 @@ class Projects::GroupLinksController < Projects::ApplicationController
 
if group
return render_404 unless can?(current_user, :read_group, group)
Projects::GroupLinks::CreateService.new(project, current_user, group_link_create_params).execute(group)
else
flash[:alert] = 'Please select a group.'
Loading
Loading
Loading
Loading
@@ -171,6 +171,7 @@ class Projects::IssuesController < Projects::ApplicationController
 
def issue
return @issue if defined?(@issue)
# The Sortable default scope causes performance issues when used with find_by
@issuable = @noteable = @issue ||= @project.issues.where(iid: params[:id]).reorder(nil).take!
@note = @project.notes.new(noteable: @issuable)
Loading
Loading
Loading
Loading
@@ -111,6 +111,7 @@ class Projects::LabelsController < Projects::ApplicationController
 
begin
return render_404 unless promote_service.execute(@label)
respond_to do |format|
format.html do
redirect_to(project_labels_path(@project),
Loading
Loading
Loading
Loading
@@ -54,6 +54,7 @@ class Projects::LfsStorageController < Projects::GitHttpClientController
name = request.headers['X-Gitlab-Lfs-Tmp']
return if name.include?('/')
return unless oid.present? && name.start_with?(oid)
name
end
 
Loading
Loading
Loading
Loading
@@ -76,6 +76,7 @@ class Projects::NotesController < Projects::ApplicationController
 
def authorize_create_note!
return unless noteable.lockable?
access_denied! unless can?(current_user, :create_note, noteable)
end
end
Loading
Loading
@@ -28,6 +28,7 @@ class Projects::WikisController < Projects::ApplicationController
)
else
return render('empty') unless can?(current_user, :create_wiki, @project)
@page = WikiPage.new(@project_wiki)
@page.title = params[:id]
 
Loading
Loading
Loading
Loading
@@ -269,6 +269,7 @@ class ProjectsController < Projects::ApplicationController
def render_landing_page
if can?(current_user, :download_code, @project)
return render 'projects/no_repo' unless @project.repository_exists?
render 'projects/empty' if @project.empty_repo?
else
if @project.wiki_enabled?
Loading
Loading
Loading
Loading
@@ -18,6 +18,7 @@ class PersonalAccessTokensFinder
 
def by_user(tokens)
return tokens unless @params[:user]
tokens.where(user: @params[:user])
end
 
Loading
Loading
Loading
Loading
@@ -111,6 +111,7 @@ module DiffHelper
def diff_file_old_blob_raw_path(diff_file)
sha = diff_file.old_content_sha
return unless sha
project_raw_path(@project, tree_join(diff_file.old_content_sha, diff_file.old_path))
end
 
Loading
Loading
Loading
Loading
@@ -24,6 +24,7 @@ module EmailsHelper
 
def action_title(url)
return unless url
%w(merge_requests issues commit).each do |action|
if url.split("/").include?(action)
return "View #{action.humanize.singularize}"
Loading
Loading
Loading
Loading
@@ -53,6 +53,7 @@ module MarkupHelper
# text, wrapping anything found in the requested link
fragment.children.each do |node|
next unless node.text?
node.replace(link_to(node.text, url, html_options))
end
end
Loading
Loading
Loading
Loading
@@ -78,6 +78,7 @@ module NotificationsHelper
# Create hidden field to send notification setting source to controller
def hidden_setting_source_input(notification_setting)
return unless notification_setting.source_type
hidden_field_tag "#{notification_setting.source_type.downcase}_id", notification_setting.source_id
end
 
Loading
Loading
Loading
Loading
@@ -88,6 +88,7 @@ module TreeHelper
part_path = part if part_path.empty?
 
next if parts.count > max_links && !parts.last(2).include?(part)
yield(part, part_path)
end
end
Loading
Loading
Loading
Loading
@@ -150,6 +150,7 @@ module VisibilityLevelHelper
 
def restricted_visibility_levels(show_all = false)
return [] if current_user.admin? && !show_all
current_application_settings.restricted_visibility_levels || []
end
 
Loading
Loading
@@ -159,6 +160,7 @@ module VisibilityLevelHelper
 
def disallowed_visibility_level?(form_model, level)
return false unless form_model.respond_to?(:visibility_level_allowed?)
!form_model.visibility_level_allowed?(level)
end
 
Loading
Loading
Loading
Loading
@@ -317,6 +317,7 @@ module Ci
 
def execute_hooks
return unless project
build_data = Gitlab::DataBuilder::Build.build(self)
project.execute_hooks(build_data.dup, :job_hooks)
project.execute_services(build_data.dup, :job_hooks)
Loading
Loading
Loading
Loading
@@ -300,8 +300,10 @@ module Ci
 
def latest?
return false unless ref
commit = project.commit(ref)
return false unless commit
commit.sha == sha
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