diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-17 12:11:44 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-17 12:11:44 +0300 |
commit | e750680e89a6f98803709c172943962741eeb9e7 (patch) | |
tree | d3e28a3692460fb37c4891d646220d06e68dfa3d /lib | |
parent | a17e8b168778e5a107928671fd2829ab284e612d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
24 files changed, 38 insertions, 38 deletions
diff --git a/lib/api/commits.rb b/lib/api/commits.rb index 221e044b24d..ef9d989d013 100644 --- a/lib/api/commits.rb +++ b/lib/api/commits.rb @@ -304,8 +304,8 @@ module API not_found!('Commit') unless commit refs = [] - refs.concat(user_project.repository.branch_names_contains(commit.id).map {|name| { type: 'branch', name: name }}) unless params[:type] == 'tag' - refs.concat(user_project.repository.tag_names_contains(commit.id).map {|name| { type: 'tag', name: name }}) unless params[:type] == 'branch' + refs.concat(user_project.repository.branch_names_contains(commit.id).map { |name| { type: 'branch', name: name } }) unless params[:type] == 'tag' + refs.concat(user_project.repository.tag_names_contains(commit.id).map { |name| { type: 'tag', name: name } }) unless params[:type] == 'branch' refs = Kaminari.paginate_array(refs) present paginate(refs), with: Entities::BasicRef diff --git a/lib/api/helpers/merge_requests_helpers.rb b/lib/api/helpers/merge_requests_helpers.rb index 7c6ef1ddfe2..85648cd166d 100644 --- a/lib/api/helpers/merge_requests_helpers.rb +++ b/lib/api/helpers/merge_requests_helpers.rb @@ -131,7 +131,7 @@ module API end def self.sort_options_help - sort_options.map {|y| "`#{y}`" }.to_sentence(last_word_connector: ' or ') + sort_options.map { |y| "`#{y}`" }.to_sentence(last_word_connector: ' or ') end end end diff --git a/lib/backup/manager.rb b/lib/backup/manager.rb index a95311e0ecc..902eb8f6659 100644 --- a/lib/backup/manager.rb +++ b/lib/backup/manager.rb @@ -519,7 +519,7 @@ module Backup end def available_timestamps - @backup_file_list.map {|item| item.gsub("#{FILE_NAME_SUFFIX}", "")} + @backup_file_list.map { |item| item.gsub("#{FILE_NAME_SUFFIX}", "") } end def object_storage_config diff --git a/lib/banzai/filter/references/label_reference_filter.rb b/lib/banzai/filter/references/label_reference_filter.rb index a019ae0108e..6020c7b7f58 100644 --- a/lib/banzai/filter/references/label_reference_filter.rb +++ b/lib/banzai/filter/references/label_reference_filter.rb @@ -12,13 +12,13 @@ module Banzai return Label.none unless parent.is_a?(Project) || parent.is_a?(Group) labels = find_labels(parent) - label_ids = ids.map {|y| y[:label_id]}.compact + label_ids = ids.map { |y| y[:label_id] }.compact unless label_ids.empty? id_relation = labels.where(id: label_ids) end - label_names = ids.map {|y| y[:label_name]}.compact + label_names = ids.map { |y| y[:label_name] }.compact unless label_names.empty? label_relation = labels.where(title: label_names) end diff --git a/lib/banzai/filter/references/milestone_reference_filter.rb b/lib/banzai/filter/references/milestone_reference_filter.rb index 609aaf885ba..77658f72d34 100644 --- a/lib/banzai/filter/references/milestone_reference_filter.rb +++ b/lib/banzai/filter/references/milestone_reference_filter.rb @@ -11,12 +11,12 @@ module Banzai def parent_records(parent, ids) return Milestone.none unless valid_context?(parent) - milestone_iids = ids.map {|y| y[:milestone_iid]}.compact + milestone_iids = ids.map { |y| y[:milestone_iid] }.compact unless milestone_iids.empty? iid_relation = find_milestones(parent, true).where(iid: milestone_iids) end - milestone_names = ids.map {|y| y[:milestone_name]}.compact + milestone_names = ids.map { |y| y[:milestone_name] }.compact unless milestone_names.empty? milestone_relation = find_milestones(parent, false).where(name: milestone_names) end diff --git a/lib/bitbucket/representation/base.rb b/lib/bitbucket/representation/base.rb index bb8dcd91ad5..afd20d788c2 100644 --- a/lib/bitbucket/representation/base.rb +++ b/lib/bitbucket/representation/base.rb @@ -10,7 +10,7 @@ module Bitbucket end def self.decorate(entries) - entries.map { |entry| new(entry)} + entries.map { |entry| new(entry) } end end end diff --git a/lib/bitbucket_server/representation/base.rb b/lib/bitbucket_server/representation/base.rb index a1961bae6ef..d1a3089b7f5 100644 --- a/lib/bitbucket_server/representation/base.rb +++ b/lib/bitbucket_server/representation/base.rb @@ -10,7 +10,7 @@ module BitbucketServer end def self.decorate(entries) - entries.map { |entry| new(entry)} + entries.map { |entry| new(entry) } end def self.convert_timestamp(time_usec) diff --git a/lib/gitlab/background_migration/fix_projects_without_prometheus_service.rb b/lib/gitlab/background_migration/fix_projects_without_prometheus_service.rb index 496ec0bd0a1..97a9913fa74 100644 --- a/lib/gitlab/background_migration/fix_projects_without_prometheus_service.rb +++ b/lib/gitlab/background_migration/fix_projects_without_prometheus_service.rb @@ -137,7 +137,7 @@ module Gitlab def create_sql(from_id, to_id) <<~SQL WITH created_records AS #{Gitlab::Database::AsWithMaterialized.materialized_if_supported} ( - INSERT INTO services (project_id, #{DEFAULTS.keys.map { |key| %("#{key}")}.join(',')}, created_at, updated_at) + INSERT INTO services (project_id, #{DEFAULTS.keys.map { |key| %("#{key}") }.join(',')}, created_at, updated_at) #{select_insert_values_sql(from_id, to_id)} RETURNING * ) diff --git a/lib/gitlab/contributions_calendar.rb b/lib/gitlab/contributions_calendar.rb index 4d289a59a6a..a45380aca6c 100644 --- a/lib/gitlab/contributions_calendar.rb +++ b/lib/gitlab/contributions_calendar.rb @@ -43,7 +43,7 @@ module Gitlab .group(:date) .map(&:attributes) - @activity_dates = events.each_with_object(Hash.new {|h, k| h[k] = 0 }) do |event, activities| + @activity_dates = events.each_with_object(Hash.new { |h, k| h[k] = 0 }) do |event, activities| activities[event["date"]] += event["num_events"] end end diff --git a/lib/gitlab/database/migrations/base_background_runner.rb b/lib/gitlab/database/migrations/base_background_runner.rb index 2772502140e..a9440cafd30 100644 --- a/lib/gitlab/database/migrations/base_background_runner.rb +++ b/lib/gitlab/database/migrations/base_background_runner.rb @@ -38,7 +38,7 @@ module Gitlab per_background_migration_result_dir = File.join(@result_dir, migration_name) instrumentation = Instrumentation.new(result_dir: per_background_migration_result_dir) - batch_names = (1..).each.lazy.map { |i| "batch_#{i}"} + batch_names = (1..).each.lazy.map { |i| "batch_#{i}" } jobs.shuffle.each do |j| break if run_until <= Time.current diff --git a/lib/gitlab/database/postgres_hll/buckets.rb b/lib/gitlab/database/postgres_hll/buckets.rb index 76818bbf340..cbc9544d905 100644 --- a/lib/gitlab/database/postgres_hll/buckets.rb +++ b/lib/gitlab/database/postgres_hll/buckets.rb @@ -38,7 +38,7 @@ module Gitlab # # @param other_buckets_hash hash with HyperLogLog structure representation def merge_hash!(other_buckets_hash) - buckets.merge!(other_buckets_hash) {|_key, old, new| new > old ? new : old } + buckets.merge!(other_buckets_hash) { |_key, old, new| new > old ? new : old } end # Serialize instance underlying HyperLogLog structure to JSON format, that can be stored in various persistence layers @@ -61,7 +61,7 @@ module Gitlab num_uniques = ( ((TOTAL_BUCKETS**2) * (0.7213 / (1 + 1.079 / TOTAL_BUCKETS))) / - (num_zero_buckets + buckets.values.sum { |bucket_hash| 2**(-1 * bucket_hash)} ) + (num_zero_buckets + buckets.values.sum { |bucket_hash| 2**(-1 * bucket_hash) } ) ).to_i if num_zero_buckets > 0 && num_uniques < 2.5 * TOTAL_BUCKETS diff --git a/lib/gitlab/diff/rendered/notebook/diff_file.rb b/lib/gitlab/diff/rendered/notebook/diff_file.rb index 3e1652bd318..31cbdc156cf 100644 --- a/lib/gitlab/diff/rendered/notebook/diff_file.rb +++ b/lib/gitlab/diff/rendered/notebook/diff_file.rb @@ -56,7 +56,7 @@ module Gitlab ) lines.zip(line_positions_at_source_diff(lines, transformed_blocks)) - .map { |line, positions| mutate_line(line, positions, lines_in_source)} + .map { |line, positions| mutate_line(line, positions, lines_in_source) } end end diff --git a/lib/gitlab/diff/rendered/notebook/diff_file_helper.rb b/lib/gitlab/diff/rendered/notebook/diff_file_helper.rb index f381792953e..ad709a79f30 100644 --- a/lib/gitlab/diff/rendered/notebook/diff_file_helper.rb +++ b/lib/gitlab/diff/rendered/notebook/diff_file_helper.rb @@ -77,8 +77,8 @@ module Gitlab def lines_in_source_diff(source_diff_lines, is_deleted_file, is_added_file) { - from: is_added_file ? Set[] : source_diff_lines.map {|l| l.old_pos}.to_set, - to: is_deleted_file ? Set[] : source_diff_lines.map {|l| l.new_pos}.to_set + from: is_added_file ? Set[] : source_diff_lines.map { |l| l.old_pos }.to_set, + to: is_deleted_file ? Set[] : source_diff_lines.map { |l| l.new_pos }.to_set } end diff --git a/lib/gitlab/email/message/in_product_marketing/helper.rb b/lib/gitlab/email/message/in_product_marketing/helper.rb index 0a0e55c2999..73d1e0743cc 100644 --- a/lib/gitlab/email/message/in_product_marketing/helper.rb +++ b/lib/gitlab/email/message/in_product_marketing/helper.rb @@ -67,7 +67,7 @@ module Gitlab def list(array) case format when :html - tag.ul { array.map { |item| tag.li item} } + tag.ul { array.map { |item| tag.li item } } else '- ' + array.join("\n- ") end diff --git a/lib/gitlab/issues/rebalancing/state.rb b/lib/gitlab/issues/rebalancing/state.rb index 3d3fd9419b2..abb50281f7a 100644 --- a/lib/gitlab/issues/rebalancing/state.rb +++ b/lib/gitlab/issues/rebalancing/state.rb @@ -38,10 +38,10 @@ module Gitlab def rebalance_in_progress? is_running = case rebalanced_container_type when NAMESPACE - namespace_ids = self.class.current_rebalancing_containers.map {|string| string.split("#{NAMESPACE}/").second.to_i }.compact + namespace_ids = self.class.current_rebalancing_containers.map { |string| string.split("#{NAMESPACE}/").second.to_i }.compact namespace_ids.include?(root_namespace.id) when PROJECT - project_ids = self.class.current_rebalancing_containers.map {|string| string.split("#{PROJECT}/").second.to_i }.compact + project_ids = self.class.current_rebalancing_containers.map { |string| string.split("#{PROJECT}/").second.to_i }.compact project_ids.include?(projects.take.id) # rubocop:disable CodeReuse/ActiveRecord else false @@ -90,11 +90,11 @@ module Gitlab end def issue_count - @issue_count ||= with_redis { |redis| redis.zcard(issue_ids_key)} + @issue_count ||= with_redis { |redis| redis.zcard(issue_ids_key) } end def remove_current_project_id_cache - with_redis { |redis| redis.del(current_project_key)} + with_redis { |redis| redis.del(current_project_key) } end def refresh_keys_expiration diff --git a/lib/gitlab/profiler.rb b/lib/gitlab/profiler.rb index d15b57eb888..fd9f73d18c1 100644 --- a/lib/gitlab/profiler.rb +++ b/lib/gitlab/profiler.rb @@ -146,7 +146,7 @@ module Gitlab if user API::Helpers::CommonHelpers.send(:define_method, :find_current_user!) { user } # rubocop:disable GitlabSecurity/PublicSend ApplicationController.send(:define_method, :current_user) { user } # rubocop:disable GitlabSecurity/PublicSend - ApplicationController.send(:define_method, :authenticate_user!) { } # rubocop:disable GitlabSecurity/PublicSend + ApplicationController.send(:define_method, :authenticate_user!) {} # rubocop:disable GitlabSecurity/PublicSend end yield.tap do diff --git a/lib/kramdown/converter/commonmark.rb b/lib/kramdown/converter/commonmark.rb index 4abb34cc008..33ec9dd1fbc 100644 --- a/lib/kramdown/converter/commonmark.rb +++ b/lib/kramdown/converter/commonmark.rb @@ -34,7 +34,7 @@ module Kramdown def convert_codeblock(el, _opts) # Although tildes are supported in CommonMark, backticks are more common "```#{el.options[:lang]}\n" + - el.value.split(/\n/).map {|l| l.empty? ? "" : "#{l}" }.join("\n") + + el.value.split(/\n/).map { |l| l.empty? ? "" : "#{l}" }.join("\n") + "\n```\n\n" end @@ -43,7 +43,7 @@ module Kramdown if el.children.first && el.children.first.type == :p && !el.children.first.options[:transparent] if el.children.size == 1 && @stack.last.children.last == el && - (@stack.last.children.any? {|c| c.children.first.type != :p } || @stack.last.children.size == 1) + (@stack.last.children.any? { |c| c.children.first.type != :p } || @stack.last.children.size == 1) # replace the end of block character res.sub!(/\^\n\z/m, "#{END_OF_BLOCK}\n") end @@ -82,7 +82,7 @@ module Kramdown def convert_tr(el, opts) return super unless @options[:html_tables] - "<tr>\n#{el.children.map {|c| convert(c, opts) }.join}</tr>\n" + "<tr>\n#{el.children.map { |c| convert(c, opts) }.join}</tr>\n" end def convert_td(el, opts) diff --git a/lib/release_highlights/validator/entry.rb b/lib/release_highlights/validator/entry.rb index b46605fdc37..2b4889e0131 100644 --- a/lib/release_highlights/validator/entry.rb +++ b/lib/release_highlights/validator/entry.rb @@ -71,7 +71,7 @@ module ReleaseHighlights end def find_node(key) - entry.children.find {|node| node.try(:value) == key.to_s } + entry.children.find { |node| node.try(:value) == key.to_s } end end end diff --git a/lib/security/ci_configuration/sast_build_action.rb b/lib/security/ci_configuration/sast_build_action.rb index 73298bcd070..448d4fbeacb 100644 --- a/lib/security/ci_configuration/sast_build_action.rb +++ b/lib/security/ci_configuration/sast_build_action.rb @@ -33,8 +33,8 @@ module Security analyzer_variables = analyzer_variables_for(config, key) analyzer_variables['SAST_EXCLUDED_ANALYZERS'] = if key == :value config[:analyzers] - &.reject {|a| a[:enabled] } - &.collect {|a| a[:name] } + &.reject { |a| a[:enabled] } + &.collect { |a| a[:name] } &.sort &.join(', ') else @@ -46,9 +46,9 @@ module Security def analyzer_variables_for(config, key) config[:analyzers] - &.select {|a| a[:enabled] && a[:variables] } - &.flat_map {|a| a[:variables] } - &.collect {|v| [v[:field], v[key]] }.to_h + &.select { |a| a[:enabled] && a[:variables] } + &.flat_map { |a| a[:variables] } + &.collect { |v| [v[:field], v[key]] }.to_h end def update_existing_content! diff --git a/lib/tasks/gitlab/db.rake b/lib/tasks/gitlab/db.rake index 5ed54bb6921..30e0e3e72ff 100644 --- a/lib/tasks/gitlab/db.rake +++ b/lib/tasks/gitlab/db.rake @@ -294,7 +294,7 @@ namespace :gitlab do # gc = Gitlab::CurrentSettings.current_application_settings seed_projects = [Gitlab::CurrentSettings.current_application_settings.self_monitoring_project] - if (Project.count - seed_projects.count {|x| !x.nil? }).eql?(0) + if (Project.count - seed_projects.count { |x| !x.nil? }).eql?(0) puts "No user created projects. Database not active" exit 1 end diff --git a/lib/tasks/gitlab/info.rake b/lib/tasks/gitlab/info.rake index 6f42bf8c946..161c7dd38ac 100644 --- a/lib/tasks/gitlab/info.rake +++ b/lib/tasks/gitlab/info.rake @@ -19,7 +19,7 @@ namespace :gitlab do # check for system defined proxies if Gitlab.ee? - proxies = Gitlab::Proxy.detect_proxy.map {|k, v| "#{k}: #{v}"}.join("\n\t\t") + proxies = Gitlab::Proxy.detect_proxy.map { |k, v| "#{k}: #{v}" }.join("\n\t\t") end # check Go version diff --git a/lib/tasks/gitlab/praefect.rake b/lib/tasks/gitlab/praefect.rake index 0a34a004690..6874a55e08a 100644 --- a/lib/tasks/gitlab/praefect.rake +++ b/lib/tasks/gitlab/praefect.rake @@ -45,7 +45,7 @@ namespace :gitlab do header.concat(sorted_replicas.map { |r| r.repository.storage_name }) row = [project.name] << replicas_resp.primary.checksum - row.concat(sorted_replicas.map {|r| r.checksum}) + row.concat(sorted_replicas.map { |r| r.checksum }) rescue StandardError puts 'Something went wrong when getting replicas.' next diff --git a/lib/tasks/gitlab/shell.rake b/lib/tasks/gitlab/shell.rake index 8627a326247..cf9876366aa 100644 --- a/lib/tasks/gitlab/shell.rake +++ b/lib/tasks/gitlab/shell.rake @@ -27,7 +27,7 @@ namespace :gitlab do }.stringify_keys # Generate config.yml based on existing gitlab settings - File.open("config.yml", "w+") {|f| f.puts config.to_yaml } + File.open("config.yml", "w+") { |f| f.puts config.to_yaml } [ %w(bin/install) + repository_storage_paths_args, diff --git a/lib/tasks/gitlab/tw/codeowners.rake b/lib/tasks/gitlab/tw/codeowners.rake index 4d6e9fd303e..f6c518784a9 100644 --- a/lib/tasks/gitlab/tw/codeowners.rake +++ b/lib/tasks/gitlab/tw/codeowners.rake @@ -128,7 +128,7 @@ namespace :tw do if errors.present? puts "-----" puts "ERRORS - the following files are missing the correct metadata:" - errors.map { |file| puts file.gsub(Dir.pwd, ".")} + errors.map { |file| puts file.gsub(Dir.pwd, ".") } end end end |