diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-22 00:08:57 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-22 00:08:57 +0000 |
commit | 4584816f15e57af3fbbf1d1280b691549384e1aa (patch) | |
tree | 4679d46df039ee9ae399da1f7963616cd06af5e8 | |
parent | 4c344d3be4b52751778ae896d2f9b19a6135540b (diff) | |
download | gitlab-ce-4584816f15e57af3fbbf1d1280b691549384e1aa.tar.gz |
Add latest changes from gitlab-org/gitlab@master
-rw-r--r-- | .rubocop_todo.yml | 15 | ||||
-rw-r--r-- | app/validators/addressable_url_validator.rb | 6 | ||||
-rw-r--r-- | config/initializers/action_dispatch_journey_formatter.rb | 4 | ||||
-rw-r--r-- | doc/development/telemetry/usage_ping.md | 3 | ||||
-rw-r--r-- | doc/user/project/static_site_editor/index.md | 7 | ||||
-rw-r--r-- | lib/gitlab/config/entry/configurable.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/config/entry/node.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/discussions_diff/file_collection.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/error_tracking.rb | 3 | ||||
-rw-r--r-- | lib/rspec_flaky/flaky_examples_collection.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/database_importers/common_metrics/prometheus_metric_spec.rb | 4 |
11 files changed, 24 insertions, 30 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 9e3a54fa7e9..28c5f33d936 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -569,21 +569,6 @@ Style/HashTransformKeys: - 'lib/banzai/filter/commit_trailers_filter.rb' - 'lib/gitlab/analytics/cycle_analytics/stage_events.rb' -# Offense count: 10 -# Cop supports --auto-correct. -Style/HashTransformValues: - Exclude: - - 'app/validators/addressable_url_validator.rb' - - 'config/initializers/action_dispatch_journey_formatter.rb' - - 'ee/app/helpers/compliance_management/compliance_framework/project_settings_helper.rb' - - 'ee/app/services/packages/nuget/metadata_extraction_service.rb' - - 'lib/gitlab/config/entry/configurable.rb' - - 'lib/gitlab/config/entry/node.rb' - - 'lib/gitlab/discussions_diff/file_collection.rb' - - 'lib/gitlab/error_tracking.rb' - - 'lib/rspec_flaky/flaky_examples_collection.rb' - - 'spec/lib/gitlab/database_importers/common_metrics/prometheus_metric_spec.rb' - # Offense count: 31 # Configuration parameters: AllowIfModifier. Style/IfInsideElse: diff --git a/app/validators/addressable_url_validator.rb b/app/validators/addressable_url_validator.rb index 99f503c3f06..9fa99903e36 100644 --- a/app/validators/addressable_url_validator.rb +++ b/app/validators/addressable_url_validator.rb @@ -95,9 +95,9 @@ class AddressableUrlValidator < ActiveModel::EachValidator end def current_options - options.map do |option, value| - [option, value.is_a?(Proc) ? value.call(record) : value] - end.to_h + options.transform_values do |value| + value.is_a?(Proc) ? value.call(record) : value + end end def blocker_args diff --git a/config/initializers/action_dispatch_journey_formatter.rb b/config/initializers/action_dispatch_journey_formatter.rb index 93cf407c73c..108fb2e5012 100644 --- a/config/initializers/action_dispatch_journey_formatter.rb +++ b/config/initializers/action_dispatch_journey_formatter.rb @@ -9,8 +9,8 @@ module ActionDispatch module Path class Pattern def requirements_for_missing_keys_check - @requirements_for_missing_keys_check ||= requirements.each_with_object({}) do |(key, regex), hash| - hash[key] = /\A#{regex}\Z/ + @requirements_for_missing_keys_check ||= requirements.transform_values do |regex| + /\A#{regex}\Z/ end end end diff --git a/doc/development/telemetry/usage_ping.md b/doc/development/telemetry/usage_ping.md index cdcee1a43f4..6bc37e2ed65 100644 --- a/doc/development/telemetry/usage_ping.md +++ b/doc/development/telemetry/usage_ping.md @@ -461,7 +461,8 @@ appear to be associated to any of the services running, since they all appear to | `releases` | `counts` | `release` | | | Unique release tags | | `remote_mirrors` | `counts` | | | | | | `requirements_created` | `counts` | | | | | -| `snippets` | `counts` | | | | | +| `snippets` | `counts` | 'create' | | | | +| `snippets` | `counts_monthly` | 'create' | | | | | `suggestions` | `counts` | | | | | | `todos` | `counts` | | | | | | `uploads` | `counts` | | | | | diff --git a/doc/user/project/static_site_editor/index.md b/doc/user/project/static_site_editor/index.md index e2e498b605a..15c3bd5522e 100644 --- a/doc/user/project/static_site_editor/index.md +++ b/doc/user/project/static_site_editor/index.md @@ -7,6 +7,8 @@ description: "The static site editor enables users to edit content on static web > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/28758) in GitLab 12.10. > - WYSIWYG editor [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/214559) in GitLab 13.0. +> - Support for adding images through the WYSIWYG editor [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/216640) in GitLab 13.1. +> - Markdown front matter hidden on the WYSIWYG editor [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/216834) in GitLab 13.1. DANGER: **Danger:** In GitLab 13.0, we [introduced breaking changes](https://gitlab.com/gitlab-org/gitlab/-/issues/213282) @@ -78,6 +80,11 @@ Anyone satisfying the [requirements](#requirements) will be able to edit the content of the pages without prior knowledge of Git nor of your site's codebase. +NOTE: **Note:** +From GitLab 13.1 onwards, the YAML front matter of Markdown files is hidden on the +WYSIWYG editor to avoid unintended changes. To edit it, use the Markdown editing mode, the regular +GitLab file editor, or the Web IDE. + ### Use the Static Site Editor to edit your content For instance, suppose you are a recently hired technical writer at a large diff --git a/lib/gitlab/config/entry/configurable.rb b/lib/gitlab/config/entry/configurable.rb index 571e7a5127e..6bf77ebaa5b 100644 --- a/lib/gitlab/config/entry/configurable.rb +++ b/lib/gitlab/config/entry/configurable.rb @@ -62,7 +62,9 @@ module Gitlab class_methods do def nodes - Hash[(@nodes || {}).map { |key, factory| [key, factory.dup] }] + return {} unless @nodes + + @nodes.transform_values(&:dup) end def reserved_node_names diff --git a/lib/gitlab/config/entry/node.rb b/lib/gitlab/config/entry/node.rb index 84d3409ed91..f653df20b2e 100644 --- a/lib/gitlab/config/entry/node.rb +++ b/lib/gitlab/config/entry/node.rb @@ -68,7 +68,7 @@ module Gitlab value.specified? && value.relevant? end - Hash[meaningful.map { |key, entry| [key, entry.value] }] + meaningful.transform_values { |entry| entry.value } end end diff --git a/lib/gitlab/discussions_diff/file_collection.rb b/lib/gitlab/discussions_diff/file_collection.rb index 7a9d4c5c0c2..60b3a1738f1 100644 --- a/lib/gitlab/discussions_diff/file_collection.rb +++ b/lib/gitlab/discussions_diff/file_collection.rb @@ -70,8 +70,8 @@ module Gitlab # # Returns a Hash with { id => [Array of Gitlab::Diff::line], ...] def highlighted_lines_by_ids(ids) - diff_files_indexed_by_id.slice(*ids).each_with_object({}) do |(id, file), hash| - hash[id] = file.highlighted_diff_lines.map(&:to_hash) + diff_files_indexed_by_id.slice(*ids).transform_values do |file| + file.highlighted_diff_lines.map(&:to_hash) end end end diff --git a/lib/gitlab/error_tracking.rb b/lib/gitlab/error_tracking.rb index a19ce22e53f..4e215348ea1 100644 --- a/lib/gitlab/error_tracking.rb +++ b/lib/gitlab/error_tracking.rb @@ -173,8 +173,7 @@ module Gitlab .connection .schema_cache .instance_variable_get(:@columns_hash) - .map { |k, v| [k, v.map(&:first)] } - .to_h + .transform_values { |v| v.map(&:first) } event.extra.merge!(columns_hash) end diff --git a/lib/rspec_flaky/flaky_examples_collection.rb b/lib/rspec_flaky/flaky_examples_collection.rb index 290a51766e9..b86ec82bde6 100644 --- a/lib/rspec_flaky/flaky_examples_collection.rb +++ b/lib/rspec_flaky/flaky_examples_collection.rb @@ -23,7 +23,7 @@ module RspecFlaky end def to_h - Hash[map { |uid, example| [uid, example.to_h] }].deep_symbolize_keys + transform_values { |example| example.to_h }.deep_symbolize_keys end def -(other) diff --git a/spec/lib/gitlab/database_importers/common_metrics/prometheus_metric_spec.rb b/spec/lib/gitlab/database_importers/common_metrics/prometheus_metric_spec.rb index e4e8a85e7bc..37d6fcdab58 100644 --- a/spec/lib/gitlab/database_importers/common_metrics/prometheus_metric_spec.rb +++ b/spec/lib/gitlab/database_importers/common_metrics/prometheus_metric_spec.rb @@ -8,8 +8,8 @@ describe Gitlab::DatabaseImporters::CommonMetrics::PrometheusMetric do end it '.group_titles equals ::PrometheusMetric' do - existing_group_titles = ::PrometheusMetricEnums.group_details.each_with_object({}) do |(key, value), memo| - memo[key] = value[:group_title] + existing_group_titles = ::PrometheusMetricEnums.group_details.transform_values do |value| + value[:group_title] end expect(Gitlab::DatabaseImporters::CommonMetrics::PrometheusMetricEnums.group_titles).to eq(existing_group_titles) end |