Skip to content
Snippets Groups Projects
Commit 8a4d68c5 authored by Douwe Maan's avatar Douwe Maan
Browse files

Enable Style/ConditionalAssignment

parent 7ea641b6
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -39,10 +39,10 @@ module Banzai
projects_per_reference.each do |path, project|
issue_ids = references_per_project[path]
 
if project.default_issues_tracker?
issues = project.issues.where(iid: issue_ids.to_a)
issues = if project.default_issues_tracker?
project.issues.where(iid: issue_ids.to_a)
else
issues = issue_ids.map { |id| ExternalIssue.new(id, project) }
issue_ids.map { |id| ExternalIssue.new(id, project) }
end
 
issues.each do |issue|
Loading
Loading
Loading
Loading
@@ -69,10 +69,10 @@ module Gitlab
end
 
JSON.parse(File.read(path)).map do |hash|
if digest
fname = "#{hash['unicode']}-#{hash['digest']}"
fname = if digest
"#{hash['unicode']}-#{hash['digest']}"
else
fname = hash['unicode']
hash['unicode']
end
 
{ name: hash['name'], path: File.join(base, prefix, "#{fname}.png") }
Loading
Loading
Loading
Loading
@@ -91,10 +91,10 @@ module Gitlab
our_highlight = Gitlab::Highlight.highlight(our_path, our_file, repository: repository).lines
 
lines.each do |line|
if line.type == 'old'
line.rich_text = their_highlight[line.old_line - 1].try(:html_safe)
line.rich_text = if line.type == 'old'
their_highlight[line.old_line - 1].try(:html_safe)
else
line.rich_text = our_highlight[line.new_line - 1].try(:html_safe)
our_highlight[line.new_line - 1].try(:html_safe)
end
end
end
Loading
Loading
Loading
Loading
@@ -140,10 +140,10 @@ module Gitlab
 
def find_diff_file(repository)
# We're at the initial commit, so just get that as we can't compare to anything.
if Gitlab::Git.blank_ref?(start_sha)
compare = Gitlab::Git::Commit.find(repository.raw_repository, head_sha)
compare = if Gitlab::Git.blank_ref?(start_sha)
Gitlab::Git::Commit.find(repository.raw_repository, head_sha)
else
compare = Gitlab::Git::Compare.new(
Gitlab::Git::Compare.new(
repository.raw_repository,
start_sha,
head_sha
Loading
Loading
Loading
Loading
@@ -31,10 +31,10 @@ module Gitlab
private
 
def select_body(message)
if message.multipart?
part = message.text_part || message.html_part || message
part = if message.multipart?
message.text_part || message.html_part || message
else
part = message
message
end
 
decoded = fix_charset(part)
Loading
Loading
Loading
Loading
@@ -143,10 +143,10 @@ module Gitlab
# signature this would break things. As a result we'll make sure the
# generated method _only_ accepts regular arguments if the underlying
# method also accepts them.
if method.arity == 0
args_signature = ''
args_signature = if method.arity == 0
''
else
args_signature = '*args'
'*args'
end
 
proxy_module.class_eval <<-EOF, __FILE__, __LINE__ + 1
Loading
Loading
Loading
Loading
@@ -28,10 +28,10 @@ module Gitlab
if external_users_enabled? && @user
# Check if there is overlap between the user's groups and the external groups
# setting then set user as external or internal.
if (auth_hash.groups & Gitlab::Saml::Config.external_groups).empty?
@user.external = false
@user.external = if (auth_hash.groups & Gitlab::Saml::Config.external_groups).empty?
false
else
@user.external = true
true
end
end
 
Loading
Loading
Loading
Loading
@@ -56,10 +56,10 @@ module Gitlab
def issues
issues = IssuesFinder.new(current_user).execute.where(project_id: project_ids_relation)
 
if query =~ /#(\d+)\z/
issues = issues.where(iid: $1)
issues = if query =~ /#(\d+)\z/
issues.where(iid: $1)
else
issues = issues.full_search(query)
issues.full_search(query)
end
 
issues.order('updated_at DESC')
Loading
Loading
@@ -73,10 +73,10 @@ module Gitlab
 
def merge_requests
merge_requests = MergeRequestsFinder.new(current_user).execute.in_projects(project_ids_relation)
if query =~ /[#!](\d+)\z/
merge_requests = merge_requests.where(iid: $1)
merge_requests = if query =~ /[#!](\d+)\z/
merge_requests.where(iid: $1)
else
merge_requests = merge_requests.full_search(query)
merge_requests.full_search(query)
end
merge_requests.order('updated_at DESC')
end
Loading
Loading
Loading
Loading
@@ -94,10 +94,10 @@ module Gitlab
private
 
def raw_explain(query)
if Gitlab::Database.postgresql?
explain = "EXPLAIN ANALYZE #{query};"
explain = if Gitlab::Database.postgresql?
"EXPLAIN ANALYZE #{query};"
else
explain = "EXPLAIN #{query};"
"EXPLAIN #{query};"
end
 
ActiveRecord::Base.connection.execute(explain)
Loading
Loading
Loading
Loading
@@ -47,10 +47,10 @@ describe 'issuable list', feature: true do
 
def create_issuables(issuable_type)
3.times do
if issuable_type == :issue
issuable = create(:issue, project: project, author: user)
issuable = if issuable_type == :issue
create(:issue, project: project, author: user)
else
issuable = create(:merge_request, title: FFaker::Lorem.sentence, source_project: project, source_branch: FFaker::Name.name)
create(:merge_request, title: FFaker::Lorem.sentence, source_project: project, source_branch: FFaker::Name.name)
end
 
2.times do
Loading
Loading
Loading
Loading
@@ -3,10 +3,10 @@ shared_examples 'issuables list meta-data' do |issuable_type, action = nil|
@issuable_ids = []
 
2.times do
if issuable_type == :issue
issuable = create(issuable_type, project: project)
issuable = if issuable_type == :issue
create(issuable_type, project: project)
else
issuable = create(issuable_type, title: FFaker::Lorem.sentence, source_project: project, source_branch: FFaker::Name.name)
create(issuable_type, title: FFaker::Lorem.sentence, source_project: project, source_branch: FFaker::Name.name)
end
 
@issuable_ids << issuable.id
Loading
Loading
Loading
Loading
@@ -15,10 +15,10 @@ module LoginHelpers
# user = create(:user)
# login_as(user)
def login_as(user_or_role)
if user_or_role.kind_of?(User)
@user = user_or_role
@user = if user_or_role.kind_of?(User)
user_or_role
else
@user = create(user_or_role)
create(user_or_role)
end
 
login_with(@user)
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