Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-02-22 04:02:23 +0300
committerDouwe Maan <douwe@selenight.nl>2017-02-23 18:31:57 +0300
commit8a4d68c53e9c58ad7f8dce1494f7976292b2f929 (patch)
tree773814f7079c626cafabc229f929cafbe4d4b2e7 /lib/gitlab
parent7ea641b6d0882fc782a7eb493daf8b66d076924b (diff)
Enable Style/ConditionalAssignment
Diffstat (limited to 'lib/gitlab')
-rw-r--r--lib/gitlab/award_emoji.rb6
-rw-r--r--lib/gitlab/conflict/file.rb6
-rw-r--r--lib/gitlab/diff/position.rb6
-rw-r--r--lib/gitlab/email/reply_parser.rb6
-rw-r--r--lib/gitlab/metrics/instrumentation.rb6
-rw-r--r--lib/gitlab/saml/user.rb6
-rw-r--r--lib/gitlab/search_results.rb12
-rw-r--r--lib/gitlab/sherlock/query.rb6
8 files changed, 27 insertions, 27 deletions
diff --git a/lib/gitlab/award_emoji.rb b/lib/gitlab/award_emoji.rb
index 39b43ab5489..fcb3542d181 100644
--- a/lib/gitlab/award_emoji.rb
+++ b/lib/gitlab/award_emoji.rb
@@ -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") }
diff --git a/lib/gitlab/conflict/file.rb b/lib/gitlab/conflict/file.rb
index c843315782d..fd43a224b3d 100644
--- a/lib/gitlab/conflict/file.rb
+++ b/lib/gitlab/conflict/file.rb
@@ -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
diff --git a/lib/gitlab/diff/position.rb b/lib/gitlab/diff/position.rb
index ecf62dead35..81c93f1aab5 100644
--- a/lib/gitlab/diff/position.rb
+++ b/lib/gitlab/diff/position.rb
@@ -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
diff --git a/lib/gitlab/email/reply_parser.rb b/lib/gitlab/email/reply_parser.rb
index 8c8dd1b9cef..4ddfd78130e 100644
--- a/lib/gitlab/email/reply_parser.rb
+++ b/lib/gitlab/email/reply_parser.rb
@@ -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)
diff --git a/lib/gitlab/metrics/instrumentation.rb b/lib/gitlab/metrics/instrumentation.rb
index 4b7a791e497..9a07abfed06 100644
--- a/lib/gitlab/metrics/instrumentation.rb
+++ b/lib/gitlab/metrics/instrumentation.rb
@@ -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
diff --git a/lib/gitlab/saml/user.rb b/lib/gitlab/saml/user.rb
index f253dc7477e..abde05d9b68 100644
--- a/lib/gitlab/saml/user.rb
+++ b/lib/gitlab/saml/user.rb
@@ -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
diff --git a/lib/gitlab/search_results.rb b/lib/gitlab/search_results.rb
index c9c65f76f4b..a1a6929103b 100644
--- a/lib/gitlab/search_results.rb
+++ b/lib/gitlab/search_results.rb
@@ -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')
@@ -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
diff --git a/lib/gitlab/sherlock/query.rb b/lib/gitlab/sherlock/query.rb
index 4917c4ae2ac..086fcddf721 100644
--- a/lib/gitlab/sherlock/query.rb
+++ b/lib/gitlab/sherlock/query.rb
@@ -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)