diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-27 21:08:47 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-27 21:08:47 +0000 |
commit | e4ea43b2b85ad5f3115f00220601eb719705139a (patch) | |
tree | 1888a43f802e45ebb8dfed59595a790807777c6f /lib | |
parent | 390582e118752426acf5cb25ec99103d312d891c (diff) | |
download | gitlab-ce-e4ea43b2b85ad5f3115f00220601eb719705139a.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/commit_statuses.rb | 14 | ||||
-rw-r--r-- | lib/backup/manager.rb | 6 | ||||
-rw-r--r-- | lib/gitlab/ci/ansi2html.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/cycle_analytics/usage_data.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/git/diff_collection.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/gpg/commit.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/highlight.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/project_search_results.rb | 6 | ||||
-rw-r--r-- | lib/gitlab/project_transfer.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/template/base_template.rb | 2 | ||||
-rw-r--r-- | lib/system_check/helpers.rb | 6 | ||||
-rw-r--r-- | lib/tasks/yarn.rake | 1 |
12 files changed, 22 insertions, 27 deletions
diff --git a/lib/api/commit_statuses.rb b/lib/api/commit_statuses.rb index 6e26ee309f0..2d5253fe9f1 100644 --- a/lib/api/commit_statuses.rb +++ b/lib/api/commit_statuses.rb @@ -76,14 +76,12 @@ module API name = params[:name] || params[:context] || 'default' - unless pipeline - pipeline = user_project.ci_pipelines.create!( - source: :external, - sha: commit.sha, - ref: ref, - user: current_user, - protected: user_project.protected_for?(ref)) - end + pipeline ||= user_project.ci_pipelines.create!( + source: :external, + sha: commit.sha, + ref: ref, + user: current_user, + protected: user_project.protected_for?(ref)) status = GenericCommitStatus.running_or_pending.find_or_initialize_by( project: user_project, diff --git a/lib/backup/manager.rb b/lib/backup/manager.rb index cb1f2fdcd17..2b6b10cf044 100644 --- a/lib/backup/manager.rb +++ b/lib/backup/manager.rb @@ -135,11 +135,11 @@ module Backup progress.print 'Unpacking backup ... ' - unless Kernel.system(*%W(tar -xf #{tar_file})) + if Kernel.system(*%W(tar -xf #{tar_file})) + progress.puts 'done'.color(:green) + else progress.puts 'unpacking backup failed'.color(:red) exit 1 - else - progress.puts 'done'.color(:green) end ENV["VERSION"] = "#{settings[:db_version]}" if settings[:db_version].to_i > 0 diff --git a/lib/gitlab/ci/ansi2html.rb b/lib/gitlab/ci/ansi2html.rb index a737d5543ad..3a05feee156 100644 --- a/lib/gitlab/ci/ansi2html.rb +++ b/lib/gitlab/ci/ansi2html.rb @@ -15,7 +15,7 @@ module Gitlab 4 => 'blue', 5 => 'magenta', 6 => 'cyan', - 7 => 'white', # not that this is gray in the dark (aka default) color table + 7 => 'white' # not that this is gray in the dark (aka default) color table }.freeze STYLE_SWITCHES = { diff --git a/lib/gitlab/cycle_analytics/usage_data.rb b/lib/gitlab/cycle_analytics/usage_data.rb index 644300caead..acfb641aeec 100644 --- a/lib/gitlab/cycle_analytics/usage_data.rb +++ b/lib/gitlab/cycle_analytics/usage_data.rb @@ -12,7 +12,7 @@ module Gitlab @options = { from: 7.days.ago } end - def to_json + def to_json(*) total = 0 values = diff --git a/lib/gitlab/git/diff_collection.rb b/lib/gitlab/git/diff_collection.rb index b79e30bff78..46896961867 100644 --- a/lib/gitlab/git/diff_collection.rb +++ b/lib/gitlab/git/diff_collection.rb @@ -102,7 +102,7 @@ module Gitlab def populate! return if @populated - each { nil } # force a loop through all diffs + each {} # force a loop through all diffs nil end diff --git a/lib/gitlab/gpg/commit.rb b/lib/gitlab/gpg/commit.rb index dc71d0b427a..48b327a54e1 100644 --- a/lib/gitlab/gpg/commit.rb +++ b/lib/gitlab/gpg/commit.rb @@ -16,13 +16,13 @@ module Gitlab def signature_text strong_memoize(:signature_text) do - @signature_data&.itself && @signature_data[0] + @signature_data&.itself && @signature_data[0] # rubocop:disable Lint/SafeNavigationConsistency end end def signed_text strong_memoize(:signed_text) do - @signature_data&.itself && @signature_data[1] + @signature_data&.itself && @signature_data[1] # rubocop:disable Lint/SafeNavigationConsistency end end diff --git a/lib/gitlab/highlight.rb b/lib/gitlab/highlight.rb index 22b9a038768..07c43fa4832 100644 --- a/lib/gitlab/highlight.rb +++ b/lib/gitlab/highlight.rb @@ -32,7 +32,7 @@ module Gitlab @lexer ||= custom_language || begin Rouge::Lexer.guess(filename: @blob_name, source: @blob_content).new rescue Rouge::Guesser::Ambiguous => e - e.alternatives.sort_by(&:tag).first + e.alternatives.min_by(&:tag) end end diff --git a/lib/gitlab/project_search_results.rb b/lib/gitlab/project_search_results.rb index 2669adb8455..60a2efdd849 100644 --- a/lib/gitlab/project_search_results.rb +++ b/lib/gitlab/project_search_results.rb @@ -106,10 +106,10 @@ module Gitlab @wiki_blobs ||= begin if project.wiki_enabled? && query.present? - unless project.wiki.empty? - Gitlab::WikiFileFinder.new(project, repository_wiki_ref).find(query) - else + if project.wiki.empty? [] + else + Gitlab::WikiFileFinder.new(project, repository_wiki_ref).find(query) end else [] diff --git a/lib/gitlab/project_transfer.rb b/lib/gitlab/project_transfer.rb index d8f1d1e2316..f5a8aeff73c 100644 --- a/lib/gitlab/project_transfer.rb +++ b/lib/gitlab/project_transfer.rb @@ -32,7 +32,7 @@ module Gitlab private def move(path_was, path, base_dir = nil) - base_dir = root_dir unless base_dir + base_dir ||= root_dir from = File.join(base_dir, path_was) to = File.join(base_dir, path) FileUtils.mv(from, to) diff --git a/lib/gitlab/template/base_template.rb b/lib/gitlab/template/base_template.rb index 14c9a3e0389..50e09bdcdd6 100644 --- a/lib/gitlab/template/base_template.rb +++ b/lib/gitlab/template/base_template.rb @@ -33,7 +33,7 @@ module Gitlab self end - def to_json + def to_json(*) { key: key, name: name, content: content } end diff --git a/lib/system_check/helpers.rb b/lib/system_check/helpers.rb index 07d479848fe..8fbfe7af713 100644 --- a/lib/system_check/helpers.rb +++ b/lib/system_check/helpers.rb @@ -57,11 +57,7 @@ module SystemCheck end def should_sanitize? - if ENV['SANITIZE'] == 'true' - true - else - false - end + ENV['SANITIZE'] == 'true' end def omnibus_gitlab? diff --git a/lib/tasks/yarn.rake b/lib/tasks/yarn.rake index 32061ad4a57..667d850d2de 100644 --- a/lib/tasks/yarn.rake +++ b/lib/tasks/yarn.rake @@ -1,3 +1,4 @@ +# frozen_string_literal: true namespace :yarn do desc 'Ensure Yarn is installed' |