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 18:10:32 +0300
committerDouwe Maan <douwe@selenight.nl>2017-02-23 18:31:57 +0300
commit5c7f9d69e3db27921acf6d8259245f2b4babcc2b (patch)
treeb90334ce234ddd3921e0f1780cf3bb0848adff7b /lib/gitlab
parent02494f7ce86fbf1276b384f45f58558c427eff63 (diff)
Fix code for cops
Diffstat (limited to 'lib/gitlab')
-rw-r--r--lib/gitlab/award_emoji.rb11
-rw-r--r--lib/gitlab/ci/config/entry/global.rb2
-rw-r--r--lib/gitlab/ci/config/entry/jobs.rb2
-rw-r--r--lib/gitlab/conflict/file.rb11
-rw-r--r--lib/gitlab/diff/position.rb19
-rw-r--r--lib/gitlab/email/reply_parser.rb11
-rw-r--r--lib/gitlab/metrics/instrumentation.rb11
-rw-r--r--lib/gitlab/saml/user.rb11
-rw-r--r--lib/gitlab/search_results.rb22
-rw-r--r--lib/gitlab/shell.rb2
-rw-r--r--lib/gitlab/sherlock/query.rb11
11 files changed, 61 insertions, 52 deletions
diff --git a/lib/gitlab/award_emoji.rb b/lib/gitlab/award_emoji.rb
index fcb3542d181..7555326d384 100644
--- a/lib/gitlab/award_emoji.rb
+++ b/lib/gitlab/award_emoji.rb
@@ -69,11 +69,12 @@ module Gitlab
end
JSON.parse(File.read(path)).map do |hash|
- fname = if digest
- "#{hash['unicode']}-#{hash['digest']}"
- else
- hash['unicode']
- end
+ fname =
+ if digest
+ "#{hash['unicode']}-#{hash['digest']}"
+ else
+ hash['unicode']
+ end
{ name: hash['name'], path: File.join(base, prefix, "#{fname}.png") }
end
diff --git a/lib/gitlab/ci/config/entry/global.rb b/lib/gitlab/ci/config/entry/global.rb
index 8154beea21f..0a404331225 100644
--- a/lib/gitlab/ci/config/entry/global.rb
+++ b/lib/gitlab/ci/config/entry/global.rb
@@ -49,7 +49,7 @@ module Gitlab
factory = Entry::Factory.new(Entry::Jobs).
value(@config.except(*self.class.nodes.keys)).
with(key: :jobs, parent: self,
- description: 'Jobs definition for this pipeline')
+ description: 'Jobs definition for this pipeline')
@entries[:jobs] = factory.create!
end
diff --git a/lib/gitlab/ci/config/entry/jobs.rb b/lib/gitlab/ci/config/entry/jobs.rb
index 41de7dbbb3e..7b83f0f1b69 100644
--- a/lib/gitlab/ci/config/entry/jobs.rb
+++ b/lib/gitlab/ci/config/entry/jobs.rb
@@ -35,7 +35,7 @@ module Gitlab
value(config || {}).
metadata(name: name).
with(key: name, parent: self,
- description: "#{name} job definition.")
+ description: "#{name} job definition.")
@entries[name] = factory.create!
end
diff --git a/lib/gitlab/conflict/file.rb b/lib/gitlab/conflict/file.rb
index fd43a224b3d..d80bc748209 100644
--- a/lib/gitlab/conflict/file.rb
+++ b/lib/gitlab/conflict/file.rb
@@ -91,11 +91,12 @@ module Gitlab
our_highlight = Gitlab::Highlight.highlight(our_path, our_file, repository: repository).lines
lines.each do |line|
- line.rich_text = if line.type == 'old'
- their_highlight[line.old_line - 1].try(:html_safe)
- else
- our_highlight[line.new_line - 1].try(:html_safe)
- end
+ line.rich_text =
+ if line.type == 'old'
+ their_highlight[line.old_line - 1].try(:html_safe)
+ else
+ 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 81c93f1aab5..fc728123c97 100644
--- a/lib/gitlab/diff/position.rb
+++ b/lib/gitlab/diff/position.rb
@@ -140,15 +140,16 @@ module Gitlab
def find_diff_file(repository)
# We're at the initial commit, so just get that as we can't compare to anything.
- compare = if Gitlab::Git.blank_ref?(start_sha)
- Gitlab::Git::Commit.find(repository.raw_repository, head_sha)
- else
- Gitlab::Git::Compare.new(
- repository.raw_repository,
- start_sha,
- head_sha
- )
- end
+ compare =
+ if Gitlab::Git.blank_ref?(start_sha)
+ Gitlab::Git::Commit.find(repository.raw_repository, head_sha)
+ else
+ Gitlab::Git::Compare.new(
+ repository.raw_repository,
+ start_sha,
+ head_sha
+ )
+ end
diff = compare.diffs(paths: paths).first
diff --git a/lib/gitlab/email/reply_parser.rb b/lib/gitlab/email/reply_parser.rb
index 4ddfd78130e..558df87f36d 100644
--- a/lib/gitlab/email/reply_parser.rb
+++ b/lib/gitlab/email/reply_parser.rb
@@ -31,11 +31,12 @@ module Gitlab
private
def select_body(message)
- part = if message.multipart?
- message.text_part || message.html_part || message
- else
- message
- end
+ part =
+ if message.multipart?
+ message.text_part || message.html_part || message
+ else
+ message
+ end
decoded = fix_charset(part)
diff --git a/lib/gitlab/metrics/instrumentation.rb b/lib/gitlab/metrics/instrumentation.rb
index 9a07abfed06..6aa38542cb4 100644
--- a/lib/gitlab/metrics/instrumentation.rb
+++ b/lib/gitlab/metrics/instrumentation.rb
@@ -143,11 +143,12 @@ 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.
- args_signature = if method.arity == 0
- ''
- else
- '*args'
- end
+ args_signature =
+ if method.arity == 0
+ ''
+ else
+ '*args'
+ end
proxy_module.class_eval <<-EOF, __FILE__, __LINE__ + 1
def #{name}(#{args_signature})
diff --git a/lib/gitlab/saml/user.rb b/lib/gitlab/saml/user.rb
index abde05d9b68..8a7cc690046 100644
--- a/lib/gitlab/saml/user.rb
+++ b/lib/gitlab/saml/user.rb
@@ -28,11 +28,12 @@ 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.
- @user.external = if (auth_hash.groups & Gitlab::Saml::Config.external_groups).empty?
- false
- else
- true
- end
+ @user.external =
+ if (auth_hash.groups & Gitlab::Saml::Config.external_groups).empty?
+ false
+ else
+ true
+ end
end
@user
diff --git a/lib/gitlab/search_results.rb b/lib/gitlab/search_results.rb
index a1a6929103b..ccfa517e04b 100644
--- a/lib/gitlab/search_results.rb
+++ b/lib/gitlab/search_results.rb
@@ -56,11 +56,12 @@ module Gitlab
def issues
issues = IssuesFinder.new(current_user).execute.where(project_id: project_ids_relation)
- issues = if query =~ /#(\d+)\z/
- issues.where(iid: $1)
- else
- issues.full_search(query)
- end
+ issues =
+ if query =~ /#(\d+)\z/
+ issues.where(iid: $1)
+ else
+ issues.full_search(query)
+ end
issues.order('updated_at DESC')
end
@@ -73,11 +74,12 @@ module Gitlab
def merge_requests
merge_requests = MergeRequestsFinder.new(current_user).execute.in_projects(project_ids_relation)
- merge_requests = if query =~ /[#!](\d+)\z/
- merge_requests.where(iid: $1)
- else
- merge_requests.full_search(query)
- end
+ merge_requests =
+ if query =~ /[#!](\d+)\z/
+ merge_requests.where(iid: $1)
+ else
+ merge_requests.full_search(query)
+ end
merge_requests.order('updated_at DESC')
end
diff --git a/lib/gitlab/shell.rb b/lib/gitlab/shell.rb
index 3be8d3aec9c..7374d2bc8b8 100644
--- a/lib/gitlab/shell.rb
+++ b/lib/gitlab/shell.rb
@@ -83,7 +83,7 @@ module Gitlab
# Timeout should be less than 900 ideally, to prevent the memory killer
# to silently kill the process without knowing we are timing out here.
output, status = Popen.popen([gitlab_shell_projects_path, 'import-project',
- storage, "#{name}.git", url, '800'])
+ storage, "#{name}.git", url, '800'])
raise Error, output unless status.zero?
true
end
diff --git a/lib/gitlab/sherlock/query.rb b/lib/gitlab/sherlock/query.rb
index 086fcddf721..99e56e923eb 100644
--- a/lib/gitlab/sherlock/query.rb
+++ b/lib/gitlab/sherlock/query.rb
@@ -94,11 +94,12 @@ module Gitlab
private
def raw_explain(query)
- explain = if Gitlab::Database.postgresql?
- "EXPLAIN ANALYZE #{query};"
- else
- "EXPLAIN #{query};"
- end
+ explain =
+ if Gitlab::Database.postgresql?
+ "EXPLAIN ANALYZE #{query};"
+ else
+ "EXPLAIN #{query};"
+ end
ActiveRecord::Base.connection.execute(explain)
end