Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-03-28 15:09:30 +00:00
parent 0108f676d2
commit 2456dfad81
12 changed files with 25 additions and 32 deletions

View File

@ -3428,16 +3428,6 @@ Gitlab/NamespacedClass:
# WIP: https://gitlab.com/gitlab-org/gitlab/-/issues/322739
Style/HashTransformation:
Exclude:
- 'app/controllers/projects/branches_controller.rb'
- 'app/finders/ci/commit_statuses_finder.rb'
- 'app/helpers/learn_gitlab_helper.rb'
- 'app/models/ci/build_trace_chunk.rb'
- 'app/models/concerns/cache_markdown_field.rb'
- 'app/models/gpg_key.rb'
- 'app/presenters/packages/npm/package_presenter.rb'
- 'app/services/ci/pipeline_processing/atomic_processing_service/status_collection.rb'
- 'app/services/ci/retry_build_service.rb'
- 'app/services/packages/nuget/create_dependency_service.rb'
- 'ee/app/models/ee/ci/build.rb'
- 'ee/app/models/productivity_analytics.rb'
- 'ee/app/models/sca/license_compliance.rb'

View File

@ -49,7 +49,7 @@ class Projects::BranchesController < Projects::ApplicationController
branches = BranchesFinder.new(repository, params.permit(names: [])).execute
Gitlab::GitalyClient.allow_n_plus_1_calls do
render json: branches.map { |branch| [branch.name, service.call(branch)] }.to_h
render json: branches.to_h { |branch| [branch.name, service.call(branch)] }
end
end
end

View File

@ -21,9 +21,9 @@ module Ci
def latest_commits
strong_memoize(:latest_commits) do
refs.map do |ref|
refs.to_h do |ref|
[ref.name, @repository.commit(ref.dereferenced_target).sha]
end.to_h
end
end
end

View File

@ -11,14 +11,14 @@ module LearnGitlabHelper
def onboarding_actions_data(project)
attributes = onboarding_progress(project).attributes.symbolize_keys
action_urls.map do |action, url|
action_urls.to_h do |action, url|
[
action,
url: url,
completed: attributes[OnboardingProgress.column_name(action)].present?,
svg: image_path("learn_gitlab/#{action}.svg")
]
end.to_h
end
end
private

View File

@ -30,9 +30,9 @@ module Ci
fog: 3
}.freeze
STORE_TYPES = DATA_STORES.keys.map do |store|
STORE_TYPES = DATA_STORES.keys.to_h do |store|
[store, "Ci::BuildTraceChunks::#{store.capitalize}".constantize]
end.to_h.freeze
end.freeze
enum data_store: DATA_STORES

View File

@ -56,12 +56,12 @@ module CacheMarkdownField
# Update every applicable column in a row if any one is invalidated, as we only store
# one version per row
def refresh_markdown_cache
updates = cached_markdown_fields.markdown_fields.map do |markdown_field|
updates = cached_markdown_fields.markdown_fields.to_h do |markdown_field|
[
cached_markdown_fields.html_field(markdown_field),
rendered_field_content(markdown_field)
]
end.to_h
end
updates['cached_markdown_version'] = latest_cached_markdown_version

View File

@ -71,12 +71,12 @@ class GpgKey < ApplicationRecord
end
def emails_with_verified_status
user_infos.map do |user_info|
user_infos.to_h do |user_info|
[
user_info[:email],
user.verified_email?(user_info[:email])
]
end.to_h
end
end
def verified?

View File

@ -35,9 +35,7 @@ module Packages
private
def build_package_tags
Hash[
package_tags.map { |tag| [tag.name, tag.package.version] }
]
package_tags.to_h { |tag| [tag.name, tag.package.version] }
end
def build_package_version(package, package_file)

View File

@ -91,17 +91,17 @@ module Ci
def all_statuses_by_id
strong_memoize(:all_statuses_by_id) do
all_statuses.map do |row|
all_statuses.to_h do |row|
[row[:id], row]
end.to_h
end
end
end
def all_statuses_by_name
strong_memoize(:statuses_by_name) do
all_statuses.map do |row|
all_statuses.to_h do |row|
[row[:name], row]
end.to_h
end
end
end

View File

@ -33,9 +33,9 @@ module Ci
raise Gitlab::Access::AccessDeniedError
end
attributes = self.class.clone_accessors.map do |attribute|
attributes = self.class.clone_accessors.to_h do |attribute|
[attribute, build.public_send(attribute)] # rubocop:disable GitlabSecurity/PublicSend
end.to_h
end
attributes[:user] = current_user

View File

@ -54,9 +54,9 @@ module Packages
end
def dependencies_for_create_dependency_service
names_and_versions = @dependencies.map do |dependency|
names_and_versions = @dependencies.to_h do |dependency|
[dependency[:name], version_or_empty_string(dependency[:version])]
end.to_h
end
{ 'dependencies' => names_and_versions }
end

View File

@ -0,0 +1,5 @@
---
title: Fix cop offenses for Style/HashTransformation in app directory
merge_request: 56579
author: Karthik Sivadas @karthik.sivadas
type: other