diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-02 06:09:33 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-02 06:09:33 +0300 |
commit | fd1c75caebf0eae26d2298c68aaeac3c940f84d9 (patch) | |
tree | 95f31110d545ade33287ff6135c49bb13d90520b | |
parent | 80a2f6b1d6f9a816f51d8cf00e928ce391c77ca0 (diff) |
Add latest changes from gitlab-org/gitlab@master
190 files changed, 916 insertions, 770 deletions
diff --git a/.gitlab/merge_request_templates/Default.md b/.gitlab/merge_request_templates/Default.md index 90d3c37d6c0..ecb8505e0df 100644 --- a/.gitlab/merge_request_templates/Default.md +++ b/.gitlab/merge_request_templates/Default.md @@ -8,23 +8,23 @@ that reviewers can understand your intent. Keeping the description updated is especially important if they didn't participate in the discussion. --> -## Screenshots or screen recordings +## Screenshots or screen recordings -_These are strongly recommended to assist reviewers and reduce the time to merge your change._ +_Screenshots are required for UI changes, and strongly recommended for all other merge requests._ -<!-- +<!-- Please include any relevant screenshots or screen recordings that will assist reviewers and future readers. If you need help visually verifying the change, please leave a comment and ping a GitLab reviewer, maintainer, or MR coach. --> -## How to set up and validate locally +## How to set up and validate locally _Numbered steps to set up and validate the change are strongly suggested._ -<!-- +<!-- Example below: - + 1. Enable the invite modal ```ruby Feature.enable(:invite_members_group_modal) @@ -39,7 +39,7 @@ Example below: ## MR acceptance checklist -This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability. +This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability. * [ ] I have evaluated the [MR acceptance checklist](https://docs.gitlab.com/ee/development/code_review.html#acceptance-checklist) for this MR. diff --git a/.rubocop_todo/layout/hash_alignment.yml b/.rubocop_todo/layout/hash_alignment.yml index 5d103dae210..7eed5b16358 100644 --- a/.rubocop_todo/layout/hash_alignment.yml +++ b/.rubocop_todo/layout/hash_alignment.yml @@ -130,17 +130,6 @@ Layout/HashAlignment: - 'app/graphql/types/user_status_type.rb' - 'app/graphql/types/work_item_type.rb' - 'app/graphql/types/work_items/type_type.rb' - - 'app/helpers/avatars_helper.rb' - - 'app/helpers/blob_helper.rb' - - 'app/helpers/commits_helper.rb' - - 'app/helpers/environments_helper.rb' - - 'app/helpers/events_helper.rb' - - 'app/helpers/markup_helper.rb' - - 'app/helpers/preferences_helper.rb' - - 'app/helpers/projects_helper.rb' - - 'app/helpers/sorting_helper.rb' - - 'app/helpers/todos_helper.rb' - - 'app/helpers/wiki_helper.rb' - 'app/models/bulk_imports/configuration.rb' - 'app/models/ci/bridge.rb' - 'app/models/ci/build_trace_metadata.rb' diff --git a/.rubocop_todo/layout/space_inside_block_braces.yml b/.rubocop_todo/layout/space_inside_block_braces.yml index f6128bda7f0..4714e3e64bf 100644 --- a/.rubocop_todo/layout/space_inside_block_braces.yml +++ b/.rubocop_todo/layout/space_inside_block_braces.yml @@ -84,34 +84,6 @@ Layout/SpaceInsideBlockBraces: - 'ee/spec/helpers/ee/registrations_helper_spec.rb' - 'ee/spec/helpers/ee/trial_helper_spec.rb' - 'ee/spec/helpers/projects/on_demand_scans_helper_spec.rb' - - 'ee/spec/lib/analytics/group_activity_calculator_spec.rb' - - 'ee/spec/lib/ee/gitlab/alert_management/payload/generic_spec.rb' - - 'ee/spec/lib/ee/gitlab/background_migration/drop_invalid_remediations_spec.rb' - - 'ee/spec/lib/ee/gitlab/background_migration/migrate_job_artifact_registry_to_ssf_spec.rb' - - 'ee/spec/lib/ee/gitlab/ci/reports/security/reports_spec.rb' - - 'ee/spec/lib/ee/gitlab/import_export/group/tree_saver_spec.rb' - - 'ee/spec/lib/ee/gitlab/import_export/project/tree_restorer_spec.rb' - - 'ee/spec/lib/ee/gitlab/usage_data_counters/issue_activity_unique_counter_spec.rb' - - 'ee/spec/lib/ee/sidebars/groups/menus/issues_menu_spec.rb' - - 'ee/spec/lib/ee/sidebars/groups/menus/settings_menu_spec.rb' - - 'ee/spec/lib/ee/sidebars/projects/menus/ci_cd_menu_spec.rb' - - 'ee/spec/lib/ee/sidebars/projects/menus/issues_menu_spec.rb' - - 'ee/spec/lib/ee/sidebars/projects/menus/repository_menu_spec.rb' - - 'ee/spec/lib/gitlab/auth/group_saml/gma_membership_enforcer_spec.rb' - - 'ee/spec/lib/gitlab/auth/otp/session_enforcer_spec.rb' - - 'ee/spec/lib/gitlab/ci/parsers/security/container_scanning_spec.rb' - - 'ee/spec/lib/gitlab/ci/reports/license_scanning/dependency_spec.rb' - - 'ee/spec/lib/gitlab/ci/reports/security/finding_spec.rb' - - 'ee/spec/lib/gitlab/ci/templates/dependency_scanning_gitlab_ci_yaml_spec.rb' - - 'ee/spec/lib/gitlab/email/handler/create_note_handler_spec.rb' - - 'ee/spec/lib/gitlab/geo/git_ssh_proxy_spec.rb' - - 'ee/spec/lib/gitlab/geo/log_cursor/events/repository_renamed_event_spec.rb' - - 'ee/spec/lib/gitlab/git_access_spec.rb' - - 'ee/spec/lib/gitlab/graphql/loaders/bulk_epic_aggregate_loader_spec.rb' - - 'ee/spec/lib/gitlab/ip_address_state_spec.rb' - - 'ee/spec/lib/gitlab/search_context/builder_spec.rb' - - 'ee/spec/lib/gitlab/status_page/filter/image_filter_spec.rb' - - 'ee/spec/lib/gitlab/usage/metrics/instrumentations/approval_project_rules_with_user_metric_spec.rb' - 'ee/spec/mailers/credentials_inventory_mailer_spec.rb' - 'ee/spec/migrations/geo/migrate_job_artifact_registry_spec.rb' - 'ee/spec/models/analytics/devops_adoption/enabled_namespace_spec.rb' @@ -337,139 +309,6 @@ Layout/SpaceInsideBlockBraces: - 'spec/helpers/wiki_page_version_helper_spec.rb' - 'spec/initializers/carrierwave_patch_spec.rb' - 'spec/initializers/trusted_proxies_spec.rb' - - 'spec/lib/api/entities/ci/job_request/image_spec.rb' - - 'spec/lib/api/entities/ci/job_request/port_spec.rb' - - 'spec/lib/api/helpers_spec.rb' - - 'spec/lib/banzai/cross_project_reference_spec.rb' - - 'spec/lib/banzai/filter/broadcast_message_placeholders_filter_spec.rb' - - 'spec/lib/banzai/filter/commit_trailers_filter_spec.rb' - - 'spec/lib/banzai/pipeline/plain_markdown_pipeline_spec.rb' - - 'spec/lib/banzai/renderer_spec.rb' - - 'spec/lib/bitbucket_server/connection_spec.rb' - - 'spec/lib/bulk_imports/common/pipelines/lfs_objects_pipeline_spec.rb' - - 'spec/lib/bulk_imports/common/pipelines/uploads_pipeline_spec.rb' - - 'spec/lib/bulk_imports/projects/pipelines/snippets_repository_pipeline_spec.rb' - - 'spec/lib/feature/definition_spec.rb' - - 'spec/lib/feature_spec.rb' - - 'spec/lib/gitlab/application_context_spec.rb' - - 'spec/lib/gitlab/asciidoc_spec.rb' - - 'spec/lib/gitlab/audit/ci_runner_token_author_spec.rb' - - 'spec/lib/gitlab/background_migration/copy_ci_builds_columns_to_security_scans_spec.rb' - - 'spec/lib/gitlab/batch_pop_queueing_spec.rb' - - 'spec/lib/gitlab/chat_name_token_spec.rb' - - 'spec/lib/gitlab/ci/ansi2html_spec.rb' - - 'spec/lib/gitlab/ci/ansi2json_spec.rb' - - 'spec/lib/gitlab/ci/build/prerequisite/kubernetes_namespace_spec.rb' - - 'spec/lib/gitlab/ci/config/entry/processable_spec.rb' - - 'spec/lib/gitlab/ci/config/entry/release_spec.rb' - - 'spec/lib/gitlab/ci/config/entry/tags_spec.rb' - - 'spec/lib/gitlab/ci/config/external/file/base_spec.rb' - - 'spec/lib/gitlab/ci/config/external/file/local_spec.rb' - - 'spec/lib/gitlab/ci/config/external/file/remote_spec.rb' - - 'spec/lib/gitlab/ci/config/normalizer_spec.rb' - - 'spec/lib/gitlab/ci/cron_parser_spec.rb' - - 'spec/lib/gitlab/ci/pipeline/chain/create_deployments_spec.rb' - - 'spec/lib/gitlab/ci/pipeline/chain/seed_block_spec.rb' - - 'spec/lib/gitlab/ci/pipeline/chain/seed_spec.rb' - - 'spec/lib/gitlab/ci/pipeline/chain/validate/external_spec.rb' - - 'spec/lib/gitlab/ci/pipeline/quota/deployments_spec.rb' - - 'spec/lib/gitlab/ci/reports/security/reports_spec.rb' - - 'spec/lib/gitlab/ci/reports/security/vulnerability_reports_comparer_spec.rb' - - 'spec/lib/gitlab/ci/reports/test_suite_spec.rb' - - 'spec/lib/gitlab/ci/status/build/canceled_spec.rb' - - 'spec/lib/gitlab/ci/status/build/created_spec.rb' - - 'spec/lib/gitlab/ci/status/build/manual_spec.rb' - - 'spec/lib/gitlab/ci/status/build/pending_spec.rb' - - 'spec/lib/gitlab/ci/status/build/skipped_spec.rb' - - 'spec/lib/gitlab/ci/status/processable/waiting_for_resource_spec.rb' - - 'spec/lib/gitlab/ci/templates/auto_devops_gitlab_ci_yaml_spec.rb' - - 'spec/lib/gitlab/ci/trace/remote_checksum_spec.rb' - - 'spec/lib/gitlab/ci/yaml_processor_spec.rb' - - 'spec/lib/gitlab/composer/cache_spec.rb' - - 'spec/lib/gitlab/data_builder/build_spec.rb' - - 'spec/lib/gitlab/data_builder/pipeline_spec.rb' - - 'spec/lib/gitlab/database/background_migration/batched_migration_spec.rb' - - 'spec/lib/gitlab/database/load_balancing/load_balancer_spec.rb' - - 'spec/lib/gitlab/database/load_balancing/sidekiq_server_middleware_spec.rb' - - 'spec/lib/gitlab/database/migration_helpers/v2_spec.rb' - - 'spec/lib/gitlab/database/migration_helpers_spec.rb' - - 'spec/lib/gitlab/database/migrations/lock_retry_mixin_spec.rb' - - 'spec/lib/gitlab/database/migrations/runner_spec.rb' - - 'spec/lib/gitlab/database/partitioning_spec.rb' - - 'spec/lib/gitlab/database/reindexing/grafana_notifier_spec.rb' - - 'spec/lib/gitlab/database/with_lock_retries_outside_transaction_spec.rb' - - 'spec/lib/gitlab/database/with_lock_retries_spec.rb' - - 'spec/lib/gitlab/database_importers/common_metrics/importer_spec.rb' - - 'spec/lib/gitlab/database_spec.rb' - - 'spec/lib/gitlab/email/handler/create_note_handler_spec.rb' - - 'spec/lib/gitlab/email/handler/service_desk_handler_spec.rb' - - 'spec/lib/gitlab/email/message/in_product_marketing/admin_verify_spec.rb' - - 'spec/lib/gitlab/email/message/in_product_marketing/create_spec.rb' - - 'spec/lib/gitlab/email/message/in_product_marketing/experience_spec.rb' - - 'spec/lib/gitlab/email/message/in_product_marketing/team_short_spec.rb' - - 'spec/lib/gitlab/email/message/in_product_marketing/team_spec.rb' - - 'spec/lib/gitlab/email/message/in_product_marketing/trial_short_spec.rb' - - 'spec/lib/gitlab/email/message/in_product_marketing/trial_spec.rb' - - 'spec/lib/gitlab/email/message/in_product_marketing/verify_spec.rb' - - 'spec/lib/gitlab/error_tracking/processor/sidekiq_processor_spec.rb' - - 'spec/lib/gitlab/exclusive_lease_helpers_spec.rb' - - 'spec/lib/gitlab/file_markdown_link_builder_spec.rb' - - 'spec/lib/gitlab/git/blob_spec.rb' - - 'spec/lib/gitlab/git/commit_spec.rb' - - 'spec/lib/gitlab/git/diff_collection_spec.rb' - - 'spec/lib/gitlab/git/raw_diff_change_spec.rb' - - 'spec/lib/gitlab/git/repository_spec.rb' - - 'spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb' - - 'spec/lib/gitlab/gitaly_client/commit_service_spec.rb' - - 'spec/lib/gitlab/github_import/client_spec.rb' - - 'spec/lib/gitlab/github_import/importer/pull_requests_importer_spec.rb' - - 'spec/lib/gitlab/gpg_spec.rb' - - 'spec/lib/gitlab/graphql/markdown_field_spec.rb' - - 'spec/lib/gitlab/graphql/pagination/keyset/connection_generic_keyset_spec.rb' - - 'spec/lib/gitlab/graphql/pagination/keyset/connection_spec.rb' - - 'spec/lib/gitlab/graphs/commits_spec.rb' - - 'spec/lib/gitlab/highlight_spec.rb' - - 'spec/lib/gitlab/import_export/import_test_coverage_spec.rb' - - 'spec/lib/gitlab/import_export/json/ndjson_writer_spec.rb' - - 'spec/lib/gitlab/import_export/project/tree_restorer_spec.rb' - - 'spec/lib/gitlab/import_export/version_checker_spec.rb' - - 'spec/lib/gitlab/jira/dvcs_spec.rb' - - 'spec/lib/gitlab/kubernetes/rollout_status_spec.rb' - - 'spec/lib/gitlab/metrics/background_transaction_spec.rb' - - 'spec/lib/gitlab/metrics/web_transaction_spec.rb' - - 'spec/lib/gitlab/middleware/compressed_json_spec.rb' - - 'spec/lib/gitlab/middleware/sidekiq_web_static_spec.rb' - - 'spec/lib/gitlab/otp_key_rotator_spec.rb' - - 'spec/lib/gitlab/pagination/keyset_spec.rb' - - 'spec/lib/gitlab/phabricator_import/conduit/response_spec.rb' - - 'spec/lib/gitlab/prometheus_client_spec.rb' - - 'spec/lib/gitlab/quick_actions/command_definition_spec.rb' - - 'spec/lib/gitlab/quick_actions/extractor_spec.rb' - - 'spec/lib/gitlab/rack_attack/instrumented_cache_store_spec.rb' - - 'spec/lib/gitlab/rack_attack/user_allowlist_spec.rb' - - 'spec/lib/gitlab/redis/hll_spec.rb' - - 'spec/lib/gitlab/reference_counter_spec.rb' - - 'spec/lib/gitlab/regex_spec.rb' - - 'spec/lib/gitlab/search/abuse_detection_spec.rb' - - 'spec/lib/gitlab/search_context/builder_spec.rb' - - 'spec/lib/gitlab/session_spec.rb' - - 'spec/lib/gitlab/sidekiq_daemon/memory_killer_spec.rb' - - 'spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb' - - 'spec/lib/gitlab/spamcheck/client_spec.rb' - - 'spec/lib/gitlab/suggestions/file_suggestion_spec.rb' - - 'spec/lib/gitlab/usage/metrics/name_suggestion_spec.rb' - - 'spec/lib/gitlab/usage/metrics/names_suggestions/generator_spec.rb' - - 'spec/lib/gitlab/utils/sanitize_node_link_spec.rb' - - 'spec/lib/gitlab/utils/usage_data_spec.rb' - - 'spec/lib/gitlab/utils_spec.rb' - - 'spec/lib/gitlab/verify/uploads_spec.rb' - - 'spec/lib/gitlab/version_info_spec.rb' - - 'spec/lib/json_web_token/rsa_token_spec.rb' - - 'spec/lib/marginalia_spec.rb' - - 'spec/lib/mattermost/session_spec.rb' - - 'spec/lib/microsoft_teams/notifier_spec.rb' - - 'spec/lib/sidebars/groups/menus/group_information_menu_spec.rb' - - 'spec/lib/sidebars/menu_spec.rb' - 'spec/mailers/emails/service_desk_spec.rb' - 'spec/migrations/20210812013042_remove_duplicate_project_authorizations_spec.rb' - 'spec/migrations/20210910194952_update_report_type_for_existing_approval_project_rules_spec.rb' @@ -487,7 +487,7 @@ gem 'ssh_data', '~> 1.3' gem 'spamcheck', '~> 0.1.0' # Gitaly GRPC protocol definitions -gem 'gitaly', '~> 15.2.0-rc1' +gem 'gitaly', '~> 15.3.0-rc3' # KAS GRPC protocol definitions gem 'kas-grpc', '~> 0.0.2' diff --git a/Gemfile.lock b/Gemfile.lock index e53f34a8a79..f604422f7ac 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -501,7 +501,7 @@ GEM rails (>= 3.2.0) git (1.11.0) rchardet (~> 1.8) - gitaly (15.2.0.pre.rc1) + gitaly (15.3.0.pre.rc3) grpc (~> 1.0) github-markup (1.7.0) gitlab (4.16.1) @@ -1572,7 +1572,7 @@ DEPENDENCIES gettext (~> 3.3) gettext_i18n_rails (~> 1.8.0) gettext_i18n_rails_js (~> 1.3) - gitaly (~> 15.2.0.pre.rc1) + gitaly (~> 15.3.0.pre.rc3) github-markup (~> 1.7.0) gitlab-chronic (~> 0.10.5) gitlab-dangerfiles (~> 3.5.0) diff --git a/app/helpers/avatars_helper.rb b/app/helpers/avatars_helper.rb index 9dc93779b12..617bc0e9bee 100644 --- a/app/helpers/avatars_helper.rb +++ b/app/helpers/avatars_helper.rb @@ -84,9 +84,9 @@ module AvatarsHelper end image_options = { - alt: alt_text, - src: avatar_url, - data: data_attributes, + alt: alt_text, + src: avatar_url, + data: data_attributes, class: css_class, title: user_name } diff --git a/app/helpers/blob_helper.rb b/app/helpers/blob_helper.rb index fcf6a177984..e42ac759cd6 100644 --- a/app/helpers/blob_helper.rb +++ b/app/helpers/blob_helper.rb @@ -98,9 +98,9 @@ module BlobHelper ref, path, blob: blob, - label: _("Replace"), - action: "replace", - btn_class: "default", + label: _("Replace"), + action: "replace", + btn_class: "default", modal_type: "upload" ) end @@ -111,9 +111,9 @@ module BlobHelper ref, path, blob: blob, - label: _("Delete"), - action: "delete", - btn_class: "default", + label: _("Delete"), + action: "delete", + btn_class: "default", modal_type: "remove" ) end diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb index d574aa51ec4..1920650bc93 100644 --- a/app/helpers/commits_helper.rb +++ b/app/helpers/commits_helper.rb @@ -28,7 +28,7 @@ module CommitsHelper def commit_to_html(commit, ref, project) render partial: 'projects/commits/commit', formats: :html, - locals: { + locals: { commit: commit, ref: ref, project: project diff --git a/app/helpers/environments_helper.rb b/app/helpers/environments_helper.rb index 2623e32dbc8..333237db6a4 100644 --- a/app/helpers/environments_helper.rb +++ b/app/helpers/environments_helper.rb @@ -58,17 +58,17 @@ module EnvironmentsHelper return {} unless project { - 'settings_path' => edit_project_settings_integration_path(project, 'prometheus'), - 'clusters_path' => project_clusters_path(project), - 'dashboards_endpoint' => project_performance_monitoring_dashboards_path(project, format: :json), - 'default_branch' => project.default_branch, - 'project_path' => project_path(project), - 'tags_path' => project_tags_path(project), - 'external_dashboard_url' => project.metrics_setting_external_dashboard_url, - 'custom_metrics_path' => project_prometheus_metrics_path(project), - 'validate_query_path' => validate_query_project_prometheus_metrics_path(project), - 'custom_metrics_available' => "#{custom_metrics_available?(project)}", - 'dashboard_timezone' => project.metrics_setting_dashboard_timezone.to_s.upcase + 'settings_path' => edit_project_settings_integration_path(project, 'prometheus'), + 'clusters_path' => project_clusters_path(project), + 'dashboards_endpoint' => project_performance_monitoring_dashboards_path(project, format: :json), + 'default_branch' => project.default_branch, + 'project_path' => project_path(project), + 'tags_path' => project_tags_path(project), + 'external_dashboard_url' => project.metrics_setting_external_dashboard_url, + 'custom_metrics_path' => project_prometheus_metrics_path(project), + 'validate_query_path' => validate_query_project_prometheus_metrics_path(project), + 'custom_metrics_available' => "#{custom_metrics_available?(project)}", + 'dashboard_timezone' => project.metrics_setting_dashboard_timezone.to_s.upcase } end @@ -77,9 +77,9 @@ module EnvironmentsHelper { 'metrics_dashboard_base_path' => metrics_dashboard_base_path(environment, project), - 'current_environment_name' => environment.name, - 'has_metrics' => "#{environment.has_metrics?}", - 'environment_state' => "#{environment.state}" + 'current_environment_name' => environment.name, + 'has_metrics' => "#{environment.has_metrics?}", + 'environment_state' => "#{environment.state}" } end @@ -98,8 +98,8 @@ module EnvironmentsHelper return {} unless project && environment { - 'metrics_endpoint' => additional_metrics_project_environment_path(project, environment, format: :json), - 'dashboard_endpoint' => metrics_dashboard_project_environment_path(project, environment, format: :json), + 'metrics_endpoint' => additional_metrics_project_environment_path(project, environment, format: :json), + 'dashboard_endpoint' => metrics_dashboard_project_environment_path(project, environment, format: :json), 'deployments_endpoint' => project_environment_deployments_path(project, environment, format: :json), 'operations_settings_path' => project_settings_operations_path(project), 'can_access_operations_settings' => can?(current_user, :admin_operations, project).to_s, @@ -109,14 +109,14 @@ module EnvironmentsHelper def static_metrics_data { - 'documentation_path' => help_page_path('administration/monitoring/prometheus/index.md'), + 'documentation_path' => help_page_path('administration/monitoring/prometheus/index.md'), 'add_dashboard_documentation_path' => help_page_path('operations/metrics/dashboards/index.md', anchor: 'add-a-new-dashboard-to-your-project'), - 'empty_getting_started_svg_path' => image_path('illustrations/monitoring/getting_started.svg'), - 'empty_loading_svg_path' => image_path('illustrations/monitoring/loading.svg'), - 'empty_no_data_svg_path' => image_path('illustrations/monitoring/no_data.svg'), - 'empty_no_data_small_svg_path' => image_path('illustrations/chart-empty-state-small.svg'), + 'empty_getting_started_svg_path' => image_path('illustrations/monitoring/getting_started.svg'), + 'empty_loading_svg_path' => image_path('illustrations/monitoring/loading.svg'), + 'empty_no_data_svg_path' => image_path('illustrations/monitoring/no_data.svg'), + 'empty_no_data_small_svg_path' => image_path('illustrations/chart-empty-state-small.svg'), 'empty_unable_to_connect_svg_path' => image_path('illustrations/monitoring/unable_to_connect.svg'), - 'custom_dashboard_base_path' => Gitlab::Metrics::Dashboard::RepoDashboardFinder::DASHBOARD_ROOT + 'custom_dashboard_base_path' => Gitlab::Metrics::Dashboard::RepoDashboardFinder::DASHBOARD_ROOT } end end diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb index 4ee3acd32d2..b35dc3b00cb 100644 --- a/app/helpers/events_helper.rb +++ b/app/helpers/events_helper.rb @@ -38,7 +38,7 @@ module EventsHelper active = 'active' if @event_filter.active?(key) link_opts = { class: "event-filter-link", - id: "#{key}_event_filter", + id: "#{key}_event_filter", title: tooltip } diff --git a/app/helpers/markup_helper.rb b/app/helpers/markup_helper.rb index 75f092d083d..fc558958ca3 100644 --- a/app/helpers/markup_helper.rb +++ b/app/helpers/markup_helper.rb @@ -283,8 +283,8 @@ module MarkupHelper def asciidoc_unsafe(text, context = {}) context.reverse_merge!( - commit: @commit, - ref: @ref, + commit: @commit, + ref: @ref, requested_path: @path ) Gitlab::Asciidoc.render(text, context) @@ -324,9 +324,9 @@ module MarkupHelper current_user: (current_user if defined?(current_user)), # RepositoryLinkFilter and UploadLinkFilter - commit: @commit, - wiki: @wiki, - ref: @ref, + commit: @commit, + wiki: @wiki, + ref: @ref, requested_path: @path ) diff --git a/app/helpers/preferences_helper.rb b/app/helpers/preferences_helper.rb index 39a57e786ed..57afe0ed0be 100644 --- a/app/helpers/preferences_helper.rb +++ b/app/helpers/preferences_helper.rb @@ -26,7 +26,7 @@ module PreferencesHelper def localized_dashboard_choices { projects: _("Your Projects (default)"), - stars: _("Starred Projects"), + stars: _("Starred Projects"), project_activity: _("Your Projects' Activity"), starred_project_activity: _("Starred Projects' Activity"), followed_user_activity: _("Followed Users' Activity"), diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index e586dc1f359..c52cadeaec2 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -483,35 +483,35 @@ module ProjectsHelper def tab_ability_map { - cycle_analytics: :read_cycle_analytics, - environments: :read_environment, + cycle_analytics: :read_cycle_analytics, + environments: :read_environment, metrics_dashboards: :metrics_dashboard, - milestones: :read_milestone, - snippets: :read_snippet, - settings: :admin_project, - builds: :read_build, - clusters: :read_cluster, - serverless: :read_cluster, - terraform: :read_terraform_state, - error_tracking: :read_sentry_issue, - alert_management: :read_alert_management_alert, - incidents: :read_issue, - labels: :read_label, - issues: :read_issue, - project_members: :read_project_member, - wiki: :read_wiki, - feature_flags: :read_feature_flag, - analytics: :read_analytics + milestones: :read_milestone, + snippets: :read_snippet, + settings: :admin_project, + builds: :read_build, + clusters: :read_cluster, + serverless: :read_cluster, + terraform: :read_terraform_state, + error_tracking: :read_sentry_issue, + alert_management: :read_alert_management_alert, + incidents: :read_issue, + labels: :read_label, + issues: :read_issue, + project_members: :read_project_member, + wiki: :read_wiki, + feature_flags: :read_feature_flag, + analytics: :read_analytics } end def search_tab_ability_map @search_tab_ability_map ||= tab_ability_map.merge( - blobs: :download_code, - commits: :download_code, + blobs: :download_code, + commits: :download_code, merge_requests: :read_merge_request, - notes: [:read_merge_request, :download_code, :read_issue, :read_snippet], - members: :read_project_member + notes: [:read_merge_request, :download_code, :read_issue, :read_snippet], + members: :read_project_member ) end diff --git a/app/helpers/sorting_helper.rb b/app/helpers/sorting_helper.rb index ef79e2bc86f..58f0af883f5 100644 --- a/app/helpers/sorting_helper.rb +++ b/app/helpers/sorting_helper.rb @@ -6,39 +6,39 @@ module SortingHelper # rubocop: disable Metrics/AbcSize def sort_options_hash { - sort_value_created_date => sort_title_created_date, - sort_value_downvotes => sort_title_downvotes, - sort_value_due_date => sort_title_due_date, - sort_value_due_date_later => sort_title_due_date_later, - sort_value_due_date_soon => sort_title_due_date_soon, - sort_value_label_priority => sort_title_label_priority, - sort_value_largest_group => sort_title_largest_group, - sort_value_largest_repo => sort_title_largest_repo, - sort_value_milestone => sort_title_milestone, - sort_value_milestone_later => sort_title_milestone_later, - sort_value_milestone_soon => sort_title_milestone_soon, - sort_value_name => sort_title_name, - sort_value_name_desc => sort_title_name_desc, - sort_value_oldest_created => sort_title_oldest_created, - sort_value_oldest_signin => sort_title_oldest_signin, - sort_value_oldest_updated => sort_title_oldest_updated, - sort_value_recently_created => sort_title_recently_created, - sort_value_recently_signin => sort_title_recently_signin, - sort_value_recently_updated => sort_title_recently_updated, - sort_value_popularity => sort_title_popularity, - sort_value_priority => sort_title_priority, - sort_value_merged_date => sort_title_merged_date, - sort_value_merged_recently => sort_title_merged_recently, - sort_value_merged_earlier => sort_title_merged_earlier, - sort_value_closed_date => sort_title_closed_date, - sort_value_closed_recently => sort_title_closed_recently, - sort_value_closed_earlier => sort_title_closed_earlier, - sort_value_upvotes => sort_title_upvotes, - sort_value_contacted_date => sort_title_contacted_date, + sort_value_created_date => sort_title_created_date, + sort_value_downvotes => sort_title_downvotes, + sort_value_due_date => sort_title_due_date, + sort_value_due_date_later => sort_title_due_date_later, + sort_value_due_date_soon => sort_title_due_date_soon, + sort_value_label_priority => sort_title_label_priority, + sort_value_largest_group => sort_title_largest_group, + sort_value_largest_repo => sort_title_largest_repo, + sort_value_milestone => sort_title_milestone, + sort_value_milestone_later => sort_title_milestone_later, + sort_value_milestone_soon => sort_title_milestone_soon, + sort_value_name => sort_title_name, + sort_value_name_desc => sort_title_name_desc, + sort_value_oldest_created => sort_title_oldest_created, + sort_value_oldest_signin => sort_title_oldest_signin, + sort_value_oldest_updated => sort_title_oldest_updated, + sort_value_recently_created => sort_title_recently_created, + sort_value_recently_signin => sort_title_recently_signin, + sort_value_recently_updated => sort_title_recently_updated, + sort_value_popularity => sort_title_popularity, + sort_value_priority => sort_title_priority, + sort_value_merged_date => sort_title_merged_date, + sort_value_merged_recently => sort_title_merged_recently, + sort_value_merged_earlier => sort_title_merged_earlier, + sort_value_closed_date => sort_title_closed_date, + sort_value_closed_recently => sort_title_closed_recently, + sort_value_closed_earlier => sort_title_closed_earlier, + sort_value_upvotes => sort_title_upvotes, + sort_value_contacted_date => sort_title_contacted_date, sort_value_relative_position => sort_title_relative_position, - sort_value_size => sort_title_size, - sort_value_expire_date => sort_title_expire_date, - sort_value_title => sort_title_title + sort_value_size => sort_title_size, + sort_value_expire_date => sort_title_expire_date, + sort_value_title => sort_title_title } end # rubocop: enable Metrics/AbcSize @@ -47,19 +47,19 @@ module SortingHelper use_old_sorting = Feature.disabled?(:project_list_filter_bar) || current_controller?('admin/projects') options = { - sort_value_latest_activity => sort_title_latest_activity, + sort_value_latest_activity => sort_title_latest_activity, sort_value_recently_created => sort_title_created_date, - sort_value_name => sort_title_name, - sort_value_name_desc => sort_title_name_desc, - sort_value_stars_desc => sort_title_stars + sort_value_name => sort_title_name, + sort_value_name_desc => sort_title_name_desc, + sort_value_stars_desc => sort_title_stars } if use_old_sorting options = options.merge({ - sort_value_oldest_activity => sort_title_oldest_activity, - sort_value_oldest_created => sort_title_oldest_created, + sort_value_oldest_activity => sort_title_oldest_activity, + sort_value_oldest_created => sort_title_oldest_created, sort_value_recently_created => sort_title_recently_created, - sort_value_stars_desc => sort_title_most_stars + sort_value_stars_desc => sort_title_most_stars }) end @@ -73,52 +73,52 @@ module SortingHelper def forks_sort_options_hash { sort_value_recently_created => sort_title_created_date, - sort_value_oldest_created => sort_title_created_date, - sort_value_latest_activity => sort_title_latest_activity, - sort_value_oldest_activity => sort_title_latest_activity + sort_value_oldest_created => sort_title_created_date, + sort_value_latest_activity => sort_title_latest_activity, + sort_value_oldest_activity => sort_title_latest_activity } end def projects_sort_option_titles # Only used for the project filter search bar projects_sort_options_hash.merge({ - sort_value_oldest_activity => sort_title_latest_activity, - sort_value_oldest_created => sort_title_created_date, - sort_value_name_desc => sort_title_name, - sort_value_stars_asc => sort_title_stars + sort_value_oldest_activity => sort_title_latest_activity, + sort_value_oldest_created => sort_title_created_date, + sort_value_name_desc => sort_title_name, + sort_value_stars_asc => sort_title_stars }) end def projects_reverse_sort_options_hash { - sort_value_latest_activity => sort_value_oldest_activity, + sort_value_latest_activity => sort_value_oldest_activity, sort_value_recently_created => sort_value_oldest_created, - sort_value_name => sort_value_name_desc, - sort_value_stars_desc => sort_value_stars_asc, - sort_value_oldest_activity => sort_value_latest_activity, - sort_value_oldest_created => sort_value_recently_created, - sort_value_name_desc => sort_value_name, - sort_value_stars_asc => sort_value_stars_desc + sort_value_name => sort_value_name_desc, + sort_value_stars_desc => sort_value_stars_asc, + sort_value_oldest_activity => sort_value_latest_activity, + sort_value_oldest_created => sort_value_recently_created, + sort_value_name_desc => sort_value_name, + sort_value_stars_asc => sort_value_stars_desc } end def forks_reverse_sort_options_hash { sort_value_recently_created => sort_value_oldest_created, - sort_value_oldest_created => sort_value_recently_created, - sort_value_latest_activity => sort_value_oldest_activity, - sort_value_oldest_activity => sort_value_latest_activity + sort_value_oldest_created => sort_value_recently_created, + sort_value_latest_activity => sort_value_oldest_activity, + sort_value_oldest_activity => sort_value_latest_activity } end def groups_sort_options_hash { - sort_value_name => sort_title_name, - sort_value_name_desc => sort_title_name_desc, + sort_value_name => sort_title_name, + sort_value_name_desc => sort_title_name_desc, sort_value_recently_created => sort_title_recently_created, - sort_value_oldest_created => sort_title_oldest_created, - sort_value_latest_activity => sort_title_recently_updated, - sort_value_oldest_activity => sort_title_oldest_updated + sort_value_oldest_created => sort_title_oldest_created, + sort_value_latest_activity => sort_title_recently_updated, + sort_value_oldest_activity => sort_title_oldest_updated } end @@ -136,27 +136,27 @@ module SortingHelper def milestones_sort_options_hash { - sort_value_due_date_soon => sort_title_due_date_soon, - sort_value_due_date_later => sort_title_due_date_later, - sort_value_start_date_soon => sort_title_start_date_soon, + sort_value_due_date_soon => sort_title_due_date_soon, + sort_value_due_date_later => sort_title_due_date_later, + sort_value_start_date_soon => sort_title_start_date_soon, sort_value_start_date_later => sort_title_start_date_later, - sort_value_name => sort_title_name_asc, - sort_value_name_desc => sort_title_name_desc + sort_value_name => sort_title_name_asc, + sort_value_name_desc => sort_title_name_desc } end def branches_sort_options_hash { - sort_value_name => sort_title_name, - sort_value_oldest_updated => sort_title_oldest_updated, + sort_value_name => sort_title_name, + sort_value_oldest_updated => sort_title_oldest_updated, sort_value_recently_updated => sort_title_recently_updated } end def tags_sort_options_hash { - sort_value_name => sort_title_name, - sort_value_oldest_updated => sort_title_oldest_updated, + sort_value_name => sort_title_name, + sort_value_oldest_updated => sort_title_oldest_updated, sort_value_recently_updated => sort_title_recently_updated } end @@ -240,7 +240,7 @@ module SortingHelper def audit_logs_sort_order_hash { sort_value_recently_created => sort_title_recently_created, - sort_value_oldest_created => sort_title_oldest_created + sort_value_oldest_created => sort_title_oldest_created } end @@ -336,31 +336,31 @@ module SortingHelper def packages_sort_options_hash { - sort_value_recently_created => sort_title_created_date, - sort_value_oldest_created => sort_title_created_date, - sort_value_name => sort_title_name, - sort_value_name_desc => sort_title_name, - sort_value_version_desc => sort_title_version, - sort_value_version_asc => sort_title_version, - sort_value_type_desc => sort_title_type, - sort_value_type_asc => sort_title_type, + sort_value_recently_created => sort_title_created_date, + sort_value_oldest_created => sort_title_created_date, + sort_value_name => sort_title_name, + sort_value_name_desc => sort_title_name, + sort_value_version_desc => sort_title_version, + sort_value_version_asc => sort_title_version, + sort_value_type_desc => sort_title_type, + sort_value_type_asc => sort_title_type, sort_value_project_name_desc => sort_title_project_name, - sort_value_project_name_asc => sort_title_project_name + sort_value_project_name_asc => sort_title_project_name } end def packages_reverse_sort_order_hash { - sort_value_recently_created => sort_value_oldest_created, - sort_value_oldest_created => sort_value_recently_created, - sort_value_name => sort_value_name_desc, - sort_value_name_desc => sort_value_name, - sort_value_version_desc => sort_value_version_asc, - sort_value_version_asc => sort_value_version_desc, - sort_value_type_desc => sort_value_type_asc, - sort_value_type_asc => sort_value_type_desc, + sort_value_recently_created => sort_value_oldest_created, + sort_value_oldest_created => sort_value_recently_created, + sort_value_name => sort_value_name_desc, + sort_value_name_desc => sort_value_name, + sort_value_version_desc => sort_value_version_asc, + sort_value_version_asc => sort_value_version_desc, + sort_value_type_desc => sort_value_type_asc, + sort_value_type_asc => sort_value_type_desc, sort_value_project_name_desc => sort_value_project_name_asc, - sort_value_project_name_asc => sort_value_project_name_desc + sort_value_project_name_asc => sort_value_project_name_desc } end diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb index f87125af07d..42f1b45c9c5 100644 --- a/app/helpers/todos_helper.rb +++ b/app/helpers/todos_helper.rb @@ -131,11 +131,11 @@ module TodosHelper def todos_filter_params { - state: params[:state], + state: params[:state], project_id: params[:project_id], - author_id: params[:author_id], - type: params[:type], - action_id: params[:action_id] + author_id: params[:author_id], + type: params[:type], + action_id: params[:action_id] } end diff --git a/app/helpers/wiki_helper.rb b/app/helpers/wiki_helper.rb index 02ea3c1b010..d6ffd3deafe 100644 --- a/app/helpers/wiki_helper.rb +++ b/app/helpers/wiki_helper.rb @@ -121,11 +121,11 @@ module WikiHelper def wiki_page_tracking_context(page) { - 'wiki-format' => page.format, - 'wiki-title-size' => page.title.bytesize, - 'wiki-content-size' => page.raw_content.bytesize, + 'wiki-format' => page.format, + 'wiki-title-size' => page.title.bytesize, + 'wiki-content-size' => page.raw_content.bytesize, 'wiki-directory-nest-level' => page.path.scan('/').count, - 'wiki-container-type' => page.wiki.container.class.name + 'wiki-container-type' => page.wiki.container.class.name } end diff --git a/app/services/boards/lists/move_service.rb b/app/services/boards/lists/move_service.rb index 93f81837d1a..4bb7b4dbc6d 100644 --- a/app/services/boards/lists/move_service.rb +++ b/app/services/boards/lists/move_service.rb @@ -23,7 +23,7 @@ module Boards def valid_move? new_position.present? && new_position != old_position && - new_position >= 0 && new_position < board.lists.movable.size + new_position >= 0 && new_position <= board.lists.movable.last.position end def reorder_intermediate_lists diff --git a/doc/administration/gitaly/configure_gitaly.md b/doc/administration/gitaly/configure_gitaly.md index 93e06ac3f0e..572dd6b25a2 100644 --- a/doc/administration/gitaly/configure_gitaly.md +++ b/doc/administration/gitaly/configure_gitaly.md @@ -280,8 +280,9 @@ Updates to example must be made at: ``` 1. Save the file and [reconfigure GitLab](../restart_gitlab.md#omnibus-gitlab-reconfigure). -1. Run `sudo /opt/gitlab/embedded/bin/gitaly-hooks check /var/opt/gitlab/gitaly/config.toml` - to confirm that Gitaly can perform callbacks to the GitLab internal API. +1. Confirm that Gitaly can perform callbacks to the GitLab internal API: + - For GitLab 15.3 and later, run `sudo /opt/gitlab/embedded/bin/gitaly check /var/opt/gitlab/gitaly/config.toml`. + - For GitLab 15.2 and earlier, run `sudo /opt/gitlab/embedded/bin/gitaly-hooks check /var/opt/gitlab/gitaly/config.toml`. **For installations from source** @@ -330,8 +331,9 @@ Updates to example must be made at: ``` 1. Save the files and [restart GitLab](../restart_gitlab.md#installations-from-source). -1. Run `sudo -u git /home/git/gitaly/gitaly-hooks check /home/git/gitaly/config.toml` - to confirm that Gitaly can perform callbacks to the GitLab internal API. +1. Confirm that Gitaly can perform callbacks to the GitLab internal API: + - For GitLab 15.3 and later, run `sudo /opt/gitlab/embedded/bin/gitaly check /var/opt/gitlab/gitaly/config.toml`. + - For GitLab 15.2 and earlier, run `sudo /opt/gitlab/embedded/bin/gitaly-hooks check /var/opt/gitlab/gitaly/config.toml`. WARNING: If directly copying repository data from a GitLab server to Gitaly, ensure that the metadata file, diff --git a/doc/administration/gitaly/praefect.md b/doc/administration/gitaly/praefect.md index 5635898293b..93c976db0f4 100644 --- a/doc/administration/gitaly/praefect.md +++ b/doc/administration/gitaly/praefect.md @@ -1103,10 +1103,8 @@ Particular attention should be shown to: ``` 1. Verify on each Gitaly node the Git Hooks can reach GitLab. On each Gitaly node run: - - ```shell - /opt/gitlab/embedded/bin/gitaly-hooks check /var/opt/gitlab/gitaly/config.toml - ``` + - For GitLab 15.3 and later, run `sudo /opt/gitlab/embedded/bin/gitaly check /var/opt/gitlab/gitaly/config.toml`. + - For GitLab 15.2 and earlier, run `sudo /opt/gitlab/embedded/bin/gitaly-hooks check /var/opt/gitlab/gitaly/config.toml`. 1. Verify that GitLab can reach Praefect: diff --git a/doc/administration/reference_architectures/10k_users.md b/doc/administration/reference_architectures/10k_users.md index 658baa22546..fcc32100bc8 100644 --- a/doc/administration/reference_architectures/10k_users.md +++ b/doc/administration/reference_architectures/10k_users.md @@ -2063,10 +2063,8 @@ On each node perform the following: ``` 1. Optionally, from the Gitaly servers, confirm that Gitaly can perform callbacks to the internal API: - - ```shell - sudo /opt/gitlab/embedded/bin/gitaly-hooks check /var/opt/gitlab/gitaly/config.toml - ``` + - For GitLab 15.3 and later, run `sudo /opt/gitlab/embedded/bin/gitaly check /var/opt/gitlab/gitaly/config.toml`. + - For GitLab 15.2 and earlier, run `sudo /opt/gitlab/embedded/bin/gitaly-hooks check /var/opt/gitlab/gitaly/config.toml`. When you specify `https` in the `external_url`, as in the previous example, GitLab expects that the SSL certificates are in `/etc/gitlab/ssl/`. If the diff --git a/doc/administration/reference_architectures/25k_users.md b/doc/administration/reference_architectures/25k_users.md index 59a93df2608..51d3e3d39a6 100644 --- a/doc/administration/reference_architectures/25k_users.md +++ b/doc/administration/reference_architectures/25k_users.md @@ -2068,10 +2068,8 @@ On each node perform the following: ``` 1. Optionally, from the Gitaly servers, confirm that Gitaly can perform callbacks to the internal API: - - ```shell - sudo /opt/gitlab/embedded/bin/gitaly-hooks check /var/opt/gitlab/gitaly/config.toml - ``` + - For GitLab 15.3 and later, run `sudo /opt/gitlab/embedded/bin/gitaly check /var/opt/gitlab/gitaly/config.toml`. + - For GitLab 15.2 and earlier, run `sudo /opt/gitlab/embedded/bin/gitaly-hooks check /var/opt/gitlab/gitaly/config.toml`. When you specify `https` in the `external_url`, as in the previous example, GitLab expects that the SSL certificates are in `/etc/gitlab/ssl/`. If the diff --git a/doc/administration/reference_architectures/2k_users.md b/doc/administration/reference_architectures/2k_users.md index 0308c4266ab..094b6fd753c 100644 --- a/doc/administration/reference_architectures/2k_users.md +++ b/doc/administration/reference_architectures/2k_users.md @@ -512,10 +512,8 @@ Updates to example must be made at: 1. [Reconfigure GitLab](../restart_gitlab.md#omnibus-gitlab-reconfigure) for the changes to take effect. 1. Confirm that Gitaly can perform callbacks to the internal API: - - ```shell - sudo /opt/gitlab/embedded/bin/gitaly-hooks check /var/opt/gitlab/gitaly/config.toml - ``` + - For GitLab 15.3 and later, run `sudo /opt/gitlab/embedded/bin/gitaly check /var/opt/gitlab/gitaly/config.toml`. + - For GitLab 15.2 and earlier, run `sudo /opt/gitlab/embedded/bin/gitaly-hooks check /var/opt/gitlab/gitaly/config.toml`. ### Gitaly TLS support diff --git a/doc/administration/reference_architectures/50k_users.md b/doc/administration/reference_architectures/50k_users.md index e00b521cdcd..535e483cb7d 100644 --- a/doc/administration/reference_architectures/50k_users.md +++ b/doc/administration/reference_architectures/50k_users.md @@ -2084,10 +2084,8 @@ On each node perform the following: ``` 1. Optionally, from the Gitaly servers, confirm that Gitaly can perform callbacks to the internal API: - - ```shell - sudo /opt/gitlab/embedded/bin/gitaly-hooks check /var/opt/gitlab/gitaly/config.toml - ``` + - For GitLab 15.3 and later, run `sudo /opt/gitlab/embedded/bin/gitaly check /var/opt/gitlab/gitaly/config.toml`. + - For GitLab 15.2 and earlier, run `sudo /opt/gitlab/embedded/bin/gitaly-hooks check /var/opt/gitlab/gitaly/config.toml`. When you specify `https` in the `external_url`, as in the previous example, GitLab expects that the SSL certificates are in `/etc/gitlab/ssl/`. If the diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md index 0adfa772b7e..fc8ab90ea83 100644 --- a/doc/api/graphql/reference/index.md +++ b/doc/api/graphql/reference/index.md @@ -10245,7 +10245,7 @@ CI/CD variables for a project. | <a id="cirunnershortsha"></a>`shortSha` | [`String`](#string) | First eight characters of the runner's token used to authenticate new job requests. Used as the runner's unique ID. | | <a id="cirunnertaglist"></a>`tagList` | [`[String!]`](#string) | Tags associated with the runner. | | <a id="cirunnertokenexpiresat"></a>`tokenExpiresAt` | [`Time`](#time) | Runner token expiration time. | -| <a id="cirunnerupgradestatus"></a>`upgradeStatus` **{warning-solid}** | [`CiRunnerUpgradeStatus`](#cirunnerupgradestatus) | **Introduced** in 14.10. This feature is in Alpha. It can be changed or removed at any time. | +| <a id="cirunnerupgradestatus"></a>`upgradeStatus` **{warning-solid}** | [`CiRunnerUpgradeStatus`](#cirunnerupgradestatus) | **Introduced** in 14.10. This feature is in Alpha. It can be changed or removed at any time. Availability of upgrades for the runner. | | <a id="cirunneruserpermissions"></a>`userPermissions` | [`RunnerPermissions!`](#runnerpermissions) | Permissions for the current user on the resource. | | <a id="cirunnerversion"></a>`version` | [`String`](#string) | Version of the runner. | @@ -19744,7 +19744,7 @@ Issue type. | <a id="issuetypeincident"></a>`INCIDENT` | Incident issue type. | | <a id="issuetypeissue"></a>`ISSUE` | Issue issue type. | | <a id="issuetyperequirement"></a>`REQUIREMENT` | Requirement issue type. | -| <a id="issuetypetask"></a>`TASK` **{warning-solid}** | **Introduced** in 15.2. This feature is in Alpha. It can be changed or removed at any time. | +| <a id="issuetypetask"></a>`TASK` **{warning-solid}** | **Introduced** in 15.2. This feature is in Alpha. It can be changed or removed at any time. Task issue type. Available only when feature flag `work_items` is enabled. | | <a id="issuetypetest_case"></a>`TEST_CASE` | Test Case issue type. | ### `IterationSearchableField` diff --git a/doc/api/namespaces.md b/doc/api/namespaces.md index 3972a46d7fc..50c97d55f45 100644 --- a/doc/api/namespaces.md +++ b/doc/api/namespaces.md @@ -7,7 +7,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w # Namespaces API **(FREE)** Usernames and group names fall under a special category called -[namespaces](../user/group/index.md#namespaces). +[namespaces](../user/namespace/index.md). For users and groups supported API calls see the [users](users.md) and [groups](groups.md) documentation respectively. diff --git a/doc/ci/pipelines/cicd_minutes.md b/doc/ci/pipelines/cicd_minutes.md index e03d926ec93..4b7d3845361 100644 --- a/doc/ci/pipelines/cicd_minutes.md +++ b/doc/ci/pipelines/cicd_minutes.md @@ -21,7 +21,7 @@ On GitLab.com: - CI/CD minutes quotas are enabled for both public and private projects, but public projects [consume CI/CD minutes at a slower rate](#cost-factor). -- The base monthly CI/CD minutes quota for a GitLab.com [namespace](../../user/group/index.md#namespaces) +- The base monthly CI/CD minutes quota for a GitLab.com [namespace](../../user/namespace/index.md) is determined by its [license tier](https://about.gitlab.com/pricing/). - You can [purchase additional CI/CD minutes](#purchase-additional-cicd-minutes) if you need more than the number of CI/CD minutes in your monthly quota. diff --git a/doc/development/namespaces_storage_statistics.md b/doc/development/namespaces_storage_statistics.md index e5263288210..20371c48172 100644 --- a/doc/development/namespaces_storage_statistics.md +++ b/doc/development/namespaces_storage_statistics.md @@ -14,7 +14,7 @@ storage consumed by a group, and allow easy management. ## Proposal -1. Create a new ActiveRecord model to hold the namespaces' statistics in an aggregated form (only for root [namespaces](../user/group/index.md#namespaces)). +1. Create a new ActiveRecord model to hold the namespaces' statistics in an aggregated form (only for root [namespaces](../user/namespace/index.md)). 1. Refresh the statistics in this model every time a project belonging to this namespace is changed. ## Problem diff --git a/doc/topics/git/terminology.md b/doc/topics/git/terminology.md index 4ce87aa2d11..f64e614c253 100644 --- a/doc/topics/git/terminology.md +++ b/doc/topics/git/terminology.md @@ -31,7 +31,7 @@ This copy is called a [**fork**](../../user/project/repository/forking_workflow. The process is called "creating a fork." When you fork a repository, you create a copy of the project in your own -[namespace](../../user/group/#namespaces). You then have write permissions to modify the project files +[namespace](../../user/namespace/index.md). You then have write permissions to modify the project files and settings. For example, you can fork this project, <https://gitlab.com/gitlab-tests/sample-project/>, into your namespace. diff --git a/doc/tutorials/move_personal_project_to_a_group.md b/doc/tutorials/move_personal_project_to_a_group.md index fdda42be3fa..5ebbf813ab9 100644 --- a/doc/tutorials/move_personal_project_to_a_group.md +++ b/doc/tutorials/move_personal_project_to_a_group.md @@ -24,7 +24,7 @@ A group gives you some great benefits. For example, you can: However, if you're working in a [personal project](../user/project/working_with_projects.md#view-personal-projects), you can't use these features. Personal projects are created under your -[personal namespace](../user/group/index.md#namespaces). They're not part of a group, +[personal namespace](../user/namespace/index.md). They're not part of a group, so you can't get any of the benefits and features of a group. But don't worry! You can move your existing personal project to a group. diff --git a/doc/user/free_user_limit.md b/doc/user/free_user_limit.md index b848128b160..46ed6785d65 100644 --- a/doc/user/free_user_limit.md +++ b/doc/user/free_user_limit.md @@ -7,7 +7,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w # Free user limit **(FREE SAAS)** From September 15, 2022, namespaces in GitLab.com on the Free tier -will be limited to five (5) members per [namespace](group/index.md#namespaces). +will be limited to five (5) members per [namespace](namespace/index.md). This limit applies to top-level groups and personal namespaces. In a personal namespace, the limit applies across all projects in your personal diff --git a/doc/user/group/index.md b/doc/user/group/index.md index b8880feb743..c7d92af8ee8 100644 --- a/doc/user/group/index.md +++ b/doc/user/group/index.md @@ -35,19 +35,6 @@ empty for anonymous users. The group page has a visibility level icon. Administrator users cannot create a subgroup or project with a higher visibility level than that of the immediate parent group. -## Namespaces - -In GitLab, a namespace is a unique name for a user, a group, or subgroup under -which a project can be created. - -For example, consider a user named Alex: - -| GitLab URL | Namespace | -| ---------- | --------- | -| Alex creates an account with the username `alex`: `https://gitlab.example.com/alex`. | The namespace in this case is `alex`. | -| Alex creates a group for their team with the group name `alex-team`. The group and its projects are available at: `https://gitlab.example.com/alex-team`. | The namespace in this case is `alex-team`. | -| Alex creates a subgroup of `alex-team` with the subgroup name `marketing`. The subgroup and its projects are available at: `https://gitlab.example.com/alex-team/marketing`. | The namespace in this case is `alex-team/marketing`. | - ## Related topics - [Group wikis](../project/wiki/index.md) diff --git a/doc/user/group/manage.md b/doc/user/group/manage.md index b50a41ccf31..916004273d4 100644 --- a/doc/user/group/manage.md +++ b/doc/user/group/manage.md @@ -6,7 +6,19 @@ info: To determine the technical writer assigned to the Stage/Group associated w # Manage groups -Use Groups to manage one or more related projects at the same time. +Use groups to manage one or more related projects at the same time. + +## View groups + +1. On the top bar, select **Menu > Groups**. +1. Select **Explore groups**. + +The **Groups** page shows a list of groups, sorted by last updated date. + +- To explore all public groups, select **Explore groups**. +- To view groups where you have a direct or indirect membership, select **Your groups**. This tab shows groups that you are a member of: + - Through membership of a subgroup's parent group. + - Through direct or inherited membership of a project in the group or subgroup. ## Create a group @@ -18,7 +30,7 @@ To create a group: 1. Select **Create group**. 1. Enter a name for the group in **Group name**. For a list of words that cannot be used as group names, see [reserved names](../reserved_names.md). -1. Enter a path for the group in **Group URL**, which is used for the [namespace](index.md#namespaces). +1. Enter a path for the group in **Group URL**, which is used for the [namespace](../namespace/index.md). 1. Choose the [visibility level](../public_access.md). 1. Personalize your GitLab experience by answering the following questions: - What is your role? diff --git a/doc/user/namespace/index.md b/doc/user/namespace/index.md new file mode 100644 index 00000000000..48dd4586750 --- /dev/null +++ b/doc/user/namespace/index.md @@ -0,0 +1,18 @@ +--- +stage: Manage +group: Workspace +info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments +--- + +# Namespaces + +In GitLab, a namespace is a unique name for a user, a [group](../group/index.md), or [subgroup](../group/subgroups/index.md) under +which a project can be created. + +For example, consider a user named Alex: + +| GitLab URL | Namespace | +| ---------- | --------- | +| Alex creates an account with the username `alex`: `https://gitlab.example.com/alex`. | The namespace in this case is `alex`. | +| Alex [creates a group](../group/manage.md#create-a-group) for their team with the group name `alex-team`. The group and its projects are available at: `https://gitlab.example.com/alex-team`. | The namespace in this case is `alex-team`. | +| Alex [creates a subgroup](../group/subgroups/index.md#create-a-subgroup) of `alex-team` with the subgroup name `marketing`. The subgroup and its projects are available at: `https://gitlab.example.com/alex-team/marketing`. | The namespace in this case is `alex-team/marketing`. | diff --git a/doc/user/packages/composer_repository/index.md b/doc/user/packages/composer_repository/index.md index 901fb740717..4fc55d18253 100644 --- a/doc/user/packages/composer_repository/index.md +++ b/doc/user/packages/composer_repository/index.md @@ -44,7 +44,7 @@ a group's namespace, rather than a user's namespace. Composer packages 1. Run [`composer init`](https://getcomposer.org/doc/03-cli.md#init) and answer the prompts. - For namespace, enter your unique [namespace](../../../user/group/index.md#namespaces), like your GitLab username or group name. + For namespace, enter your unique [namespace](../../../user/namespace/index.md), like your GitLab username or group name. A file called `composer.json` is created: diff --git a/doc/user/packages/terraform_module_registry/index.md b/doc/user/packages/terraform_module_registry/index.md index 2668b8b35ac..436c55f9ee0 100644 --- a/doc/user/packages/terraform_module_registry/index.md +++ b/doc/user/packages/terraform_module_registry/index.md @@ -101,7 +101,7 @@ module "<module>" { } ``` -Where `<namespace>` is the [namespace](../../../user/group/index.md#namespaces) of the Terraform module registry. +Where `<namespace>` is the [namespace](../../../user/namespace/index.md) of the Terraform module registry. ## Publish a Terraform module by using CI/CD @@ -125,7 +125,7 @@ upload: script: - TERRAFORM_MODULE_NAME=$(echo "${TERRAFORM_MODULE_NAME}" | tr " _" -) # module-name must not have spaces or underscores, so translate them to hyphens - tar -vczf ${TERRAFORM_MODULE_NAME}-${TERRAFORM_MODULE_SYSTEM}-${TERRAFORM_MODULE_VERSION}.tgz -C ${TERRAFORM_MODULE_DIR} --exclude=./.git . - - 'curl --location --header "JOB-TOKEN: ${CI_JOB_TOKEN}" + - 'curl --location --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file ${TERRAFORM_MODULE_NAME}-${TERRAFORM_MODULE_SYSTEM}-${TERRAFORM_MODULE_VERSION}.tgz ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/terraform/modules/${TERRAFORM_MODULE_NAME}/${TERRAFORM_MODULE_SYSTEM}/${TERRAFORM_MODULE_VERSION}/file' rules: diff --git a/doc/user/permissions.md b/doc/user/permissions.md index 07b78dc7788..66dfe4161a7 100644 --- a/doc/user/permissions.md +++ b/doc/user/permissions.md @@ -42,7 +42,7 @@ available only: - For group owners. The role is inherited for a group's projects. - For Administrators. -Personal [namespace](group/index.md#namespaces) owners: +Personal [namespace](namespace/index.md) owners: - Are displayed as having the Maintainer role on projects in the namespace, but have the same permissions as a user with the Owner role. - In GitLab 14.9 and later, for new projects in the namespace, are displayed as having the Owner role. diff --git a/doc/user/profile/index.md b/doc/user/profile/index.md index 746794974fe..4c859d98004 100644 --- a/doc/user/profile/index.md +++ b/doc/user/profile/index.md @@ -40,7 +40,7 @@ If you don't know your current password, select the **I forgot my password** lin ## Change your username -Your username has a unique [namespace](../group/index.md#namespaces), +Your username has a unique [namespace](../namespace/index.md), which is updated when you change your username. Before you change your username, read about [how redirects behave](../project/repository/index.md#what-happens-when-a-repository-path-changes). If you do not want to update the namespace, you can create a new user or group and transfer projects to it instead. diff --git a/doc/user/project/members/index.md b/doc/user/project/members/index.md index 2fccf8bbe5c..395a57a0d55 100644 --- a/doc/user/project/members/index.md +++ b/doc/user/project/members/index.md @@ -107,7 +107,7 @@ The members of the group are not displayed on the **Members** tab. The **Members** tab shows: - Members who are directly assigned to the project. -- If the project was created in a group [namespace](../../group/index.md#namespaces), members of that group. +- If the project was created in a group [namespace](../../namespace/index.md), members of that group. ## Import users from another project diff --git a/doc/user/project/pages/getting_started_part_one.md b/doc/user/project/pages/getting_started_part_one.md index 54b843945cd..29712a82be1 100644 --- a/doc/user/project/pages/getting_started_part_one.md +++ b/doc/user/project/pages/getting_started_part_one.md @@ -18,7 +18,7 @@ replace the Pages wildcard domain on GitLab.com (`*.gitlab.io`) with your own. If you set up a GitLab Pages project on GitLab, it's automatically accessible under a subdomain of `namespace.example.io`. -The [`namespace`](../../group/index.md#namespaces) +The [`namespace`](../../namespace/index.md) is defined by your username on GitLab.com, or the group name you created this project under. For GitLab self-managed instances, replace `example.io` diff --git a/doc/user/project/releases/index.md b/doc/user/project/releases/index.md index ad524bd150c..b22b8716d52 100644 --- a/doc/user/project/releases/index.md +++ b/doc/user/project/releases/index.md @@ -250,16 +250,25 @@ The `ADDITIONAL_CA_CERT_BUNDLE` value can also be configured as a either as a `file`, which requires the path to the certificate, or as a variable, which requires the text representation of the certificate. -### `release-cli` command line +## GitLab Release CLI tool -The entries under the `release` node are transformed into Bash commands and sent -to the Docker container, which contains the [release-cli](https://gitlab.com/gitlab-org/release-cli). -You can also call the `release-cli` directly from a `script` entry. +The [GitLab Release CLI (`release-cli`)](https://gitlab.com/gitlab-org/release-cli) tool +is a command-line tool for managing releases from the command line or from a CI/CD pipeline. +You can use the release CLI to create, update, modify, and delete releases. -For example, if you use the YAML described previously: +When you [use a CI/CD job to create a release](#creating-a-release-by-using-a-cicd-job), +the `release` keyword entries are transformed into Bash commands and sent to the Docker +container containing the `release-cli` tool. The tool then creates the release. + +You can also call the `release-cli` tool directly from a [`script`](../../../ci/yaml/index.md#script). +For example: ```shell -release-cli create --name "Release $CI_COMMIT_SHA" --description "Created using the release-cli $EXTRA_DESCRIPTION" --tag-name "v${MAJOR}.${MINOR}.${REVISION}" --ref "$CI_COMMIT_SHA" --released-at "2020-07-15T08:00:00Z" --milestone "m1" --milestone "m2" --milestone "m3" --assets-link "{\"name\":\"asset1\",\"url\":\"https://example.com/assets/1\",\"link_type\":\"other\"} +release-cli create --name "Release $CI_COMMIT_SHA" --description \ + "Created using the release-cli $EXTRA_DESCRIPTION" \ + --tag-name "v${MAJOR}.${MINOR}.${REVISION}" --ref "$CI_COMMIT_SHA" \ + --released-at "2020-07-15T08:00:00Z" --milestone "m1" --milestone "m2" --milestone "m3" \ + --assets-link "{\"name\":\"asset1\",\"url\":\"https://example.com/assets/1\",\"link_type\":\"other\"} ``` ### Create multiple releases in a single pipeline @@ -873,19 +882,6 @@ users with at least the Maintainer role to create, update, and delete releases by protecting the tag with a wildcard (`*`), and set **Maintainer** in the **Allowed to create** column. -## Release Command Line - -> [Introduced](https://gitlab.com/gitlab-org/release-cli/-/merge_requests/6) in GitLab 12.10. - -The Release CLI is a command-line tool for managing GitLab Releases from the command line or from -the GitLab CI/CD configuration file, `.gitlab-ci.yml`. - -With it, you can create, update, modify, and delete releases right through the -terminal. - -Read the [Release CLI documentation](https://gitlab.com/gitlab-org/release-cli/-/blob/master/docs/index.md) -for details. - ## Release Metrics **(ULTIMATE)** > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/259703) in GitLab Premium 13.9. diff --git a/doc/user/project/repository/forking_workflow.md b/doc/user/project/repository/forking_workflow.md index 85bea80f777..df75f19ea6c 100644 --- a/doc/user/project/repository/forking_workflow.md +++ b/doc/user/project/repository/forking_workflow.md @@ -26,7 +26,7 @@ To fork an existing project in GitLab: 1. On the project's home page, in the top right, select **{fork}** **Fork**: ![Fork this project](img/forking_workflow_fork_button_v13_10.png) 1. Optional. Edit the **Project name**. -1. For **Project URL**, select the [namespace](../../group/index.md#namespaces) +1. For **Project URL**, select the [namespace](../../namespace/index.md) your fork should belong to. 1. Add a **Project slug**. This value becomes part of the URL to your fork. It must be unique in the namespace. diff --git a/doc/user/project/working_with_projects.md b/doc/user/project/working_with_projects.md index 6d8c077b537..2501fa8b45c 100644 --- a/doc/user/project/working_with_projects.md +++ b/doc/user/project/working_with_projects.md @@ -233,7 +233,7 @@ To push your repository and create a project: ``` - For `gitlab.example.com`, use the domain name of the machine that hosts your Git repository. - - For `namespace`, use the name of your [namespace](../group/index.md#namespaces). + - For `namespace`, use the name of your [namespace](../namespace/index.md). - For `myproject`, use the name of your project. - Optional. To export existing repository tags, append the `--tags` flag to your `git push` command. 1. Optional. To configure the remote: @@ -371,7 +371,7 @@ To leave a project: 1. Select a project. 1. Select **Leave project**. The **Leave project** option only displays on the project dashboard when a project is part of a group under a -[group namespace](../group/index.md#namespaces). +[group namespace](../namespace/index.md). ## Use a project as a Go package diff --git a/doc/user/usage_quotas.md b/doc/user/usage_quotas.md index c863a9d8270..b85cab1cf47 100644 --- a/doc/user/usage_quotas.md +++ b/doc/user/usage_quotas.md @@ -67,7 +67,7 @@ you must purchase additional storage. For more details, see [Excess storage usag ## View storage usage -You can view storage usage for your project or [namespace](../user/group/#namespaces). +You can view storage usage for your project or [namespace](../user/namespace/index.md). 1. Go to your project or namespace: - For a project, on the top bar, select **Menu > Projects** and find your project. diff --git a/doc/user/workspace/index.md b/doc/user/workspace/index.md index 0ef3eb8b6fe..fbda3df8dce 100644 --- a/doc/user/workspace/index.md +++ b/doc/user/workspace/index.md @@ -17,7 +17,7 @@ sole discretion of GitLab Inc. NOTE: Workspace is currently in development. -Workspace will be above the [top-level namespaces](../group/index.md#namespaces) for you to manage +Workspace will be above the [top-level namespaces](../namespace/index.md) for you to manage everything you do as a GitLab administrator, including: - Defining and applying settings to all of your groups, subgroups, and projects. diff --git a/lib/gitlab/gitaly_client/operation_service.rb b/lib/gitlab/gitaly_client/operation_service.rb index 35d3ddf5d7f..8f5d0645a5d 100644 --- a/lib/gitlab/gitaly_client/operation_service.rb +++ b/lib/gitlab/gitaly_client/operation_service.rb @@ -44,8 +44,26 @@ module Gitlab end Gitlab::Git::Tag.new(@repository, response.tag) - rescue GRPC::FailedPrecondition => e - raise Gitlab::Git::Repository::InvalidRef, e + rescue GRPC::BadStatus => e + detailed_error = GitalyClient.decode_detailed_error(e) + + case detailed_error&.error + when :access_check + access_check_error = detailed_error.access_check + # These messages were returned from internal/allowed API calls + raise Gitlab::Git::PreReceiveError.new(fallback_message: access_check_error.error_message) + when :custom_hook + raise Gitlab::Git::PreReceiveError.new(custom_hook_error_message(detailed_error.custom_hook), + fallback_message: e.details) + when :reference_exists + raise Gitlab::Git::Repository::TagExistsError + else + if e.code == GRPC::Core::StatusCodes::FAILED_PRECONDITION + raise Gitlab::Git::Repository::InvalidRef, e + end + + raise + end end def user_create_branch(branch_name, user, start_point) diff --git a/lib/gitlab/graphql/deprecation.rb b/lib/gitlab/graphql/deprecation.rb index 7ba339d4191..9b17962f9ec 100644 --- a/lib/gitlab/graphql/deprecation.rb +++ b/lib/gitlab/graphql/deprecation.rb @@ -94,6 +94,10 @@ module Gitlab ].compact.join(' ') end + def alpha? + reason == REASON_ALPHA + end + private attr_reader :reason, :milestone, :replacement @@ -127,7 +131,7 @@ module Gitlab # Retruns 'Introduced in <milestone>' for :alpha deprecations. # Formatted to markdown or plain format. def changed_in_milestone(format: :plain) - verb = if reason == REASON_ALPHA + verb = if alpha? 'Introduced' else 'Deprecated' diff --git a/spec/lib/api/entities/ci/job_request/image_spec.rb b/spec/lib/api/entities/ci/job_request/image_spec.rb index 3ab14ffc3ae..fca3b5d3fa9 100644 --- a/spec/lib/api/entities/ci/job_request/image_spec.rb +++ b/spec/lib/api/entities/ci/job_request/image_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe API::Entities::Ci::JobRequest::Image do - let(:ports) { [{ number: 80, protocol: 'http', name: 'name' }]} + let(:ports) { [{ number: 80, protocol: 'http', name: 'name' }] } let(:image) { double(name: 'image_name', entrypoint: ['foo'], ports: ports, pull_policy: ['if-not-present']) } let(:entity) { described_class.new(image) } diff --git a/spec/lib/api/entities/ci/job_request/port_spec.rb b/spec/lib/api/entities/ci/job_request/port_spec.rb index 8e0d2cabcfc..3f2ca3275c1 100644 --- a/spec/lib/api/entities/ci/job_request/port_spec.rb +++ b/spec/lib/api/entities/ci/job_request/port_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe ::API::Entities::Ci::JobRequest::Port do - let(:port) { double(number: 80, protocol: 'http', name: 'name')} + let(:port) { double(number: 80, protocol: 'http', name: 'name') } let(:entity) { described_class.new(port) } subject { entity.as_json } diff --git a/spec/lib/api/entities/ci/job_request/service_spec.rb b/spec/lib/api/entities/ci/job_request/service_spec.rb index 47c2c4e04c9..86f2120c321 100644 --- a/spec/lib/api/entities/ci/job_request/service_spec.rb +++ b/spec/lib/api/entities/ci/job_request/service_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe API::Entities::Ci::JobRequest::Service do - let(:ports) { [{ number: 80, protocol: 'http', name: 'name' }]} + let(:ports) { [{ number: 80, protocol: 'http', name: 'name' }] } let(:service) do instance_double( ::Gitlab::Ci::Build::Image, diff --git a/spec/lib/api/helpers_spec.rb b/spec/lib/api/helpers_spec.rb index 23c97e2c0a3..cd41d362d03 100644 --- a/spec/lib/api/helpers_spec.rb +++ b/spec/lib/api/helpers_spec.rb @@ -185,7 +185,7 @@ RSpec.describe API::Helpers do context 'support for IDs and paths as argument' do let_it_be(:project) { create(:project) } - let(:user) { project.first_owner} + let(:user) { project.first_owner } before do allow(helper).to receive(:current_user).and_return(user) diff --git a/spec/lib/banzai/cross_project_reference_spec.rb b/spec/lib/banzai/cross_project_reference_spec.rb index e703bbc4927..8748a910003 100644 --- a/spec/lib/banzai/cross_project_reference_spec.rb +++ b/spec/lib/banzai/cross_project_reference_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' RSpec.describe Banzai::CrossProjectReference do let(:including_class) { Class.new.include(described_class).new } - let(:reference_cache) { Banzai::Filter::References::ReferenceCache.new(including_class, {}, {})} + let(:reference_cache) { Banzai::Filter::References::ReferenceCache.new(including_class, {}, {}) } before do allow(including_class).to receive(:context).and_return({}) diff --git a/spec/lib/banzai/filter/broadcast_message_placeholders_filter_spec.rb b/spec/lib/banzai/filter/broadcast_message_placeholders_filter_spec.rb index a2d35eaa6b6..c581750d2a9 100644 --- a/spec/lib/banzai/filter/broadcast_message_placeholders_filter_spec.rb +++ b/spec/lib/banzai/filter/broadcast_message_placeholders_filter_spec.rb @@ -29,7 +29,7 @@ RSpec.describe Banzai::Filter::BroadcastMessagePlaceholdersFilter do end context 'works with empty text' do - let(:text) {" "} + let(:text) { " " } it { expect(subject).to eq(" ") } end @@ -42,13 +42,13 @@ RSpec.describe Banzai::Filter::BroadcastMessagePlaceholdersFilter do context 'available placeholders' do context 'replaces the email of the user' do - let(:text) { "{{email}}"} + let(:text) { "{{email}}" } it { expect(subject).to eq(user.email) } end context 'replaces the name of the user' do - let(:text) { "{{name}}"} + let(:text) { "{{name}}" } it { expect(subject).to eq(user.name) } end diff --git a/spec/lib/banzai/filter/commit_trailers_filter_spec.rb b/spec/lib/banzai/filter/commit_trailers_filter_spec.rb index f7cb6b92b48..38f9bda57e6 100644 --- a/spec/lib/banzai/filter/commit_trailers_filter_spec.rb +++ b/spec/lib/banzai/filter/commit_trailers_filter_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Banzai::Filter::CommitTrailersFilter do let(:secondary_email) { create(:email, :confirmed) } let(:user) { create(:user) } - let(:trailer) { "#{FFaker::Lorem.word}-by:"} + let(:trailer) { "#{FFaker::Lorem.word}-by:" } let(:commit_message) { trailer_line(trailer, user.name, user.email) } let(:commit_message_html) { commit_html(commit_message) } diff --git a/spec/lib/banzai/pipeline/incident_management/timeline_event_pipeline_spec.rb b/spec/lib/banzai/pipeline/incident_management/timeline_event_pipeline_spec.rb index 76f2dd4b659..4bccae04fda 100644 --- a/spec/lib/banzai/pipeline/incident_management/timeline_event_pipeline_spec.rb +++ b/spec/lib/banzai/pipeline/incident_management/timeline_event_pipeline_spec.rb @@ -85,7 +85,7 @@ RSpec.describe Banzai::Pipeline::IncidentManagement::TimelineEventPipeline do end context 'when markdown contains table' do - let(:markdown) { '<table><tr><th>table head</th><tr><tr><td>table content</td></tr></table>'} + let(:markdown) { '<table><tr><th>table head</th><tr><tr><td>table content</td></tr></table>' } it { is_expected.to eq('table headtable content') } end diff --git a/spec/lib/banzai/pipeline/plain_markdown_pipeline_spec.rb b/spec/lib/banzai/pipeline/plain_markdown_pipeline_spec.rb index 80392fe264f..536f2a67415 100644 --- a/spec/lib/banzai/pipeline/plain_markdown_pipeline_spec.rb +++ b/spec/lib/banzai/pipeline/plain_markdown_pipeline_spec.rb @@ -11,9 +11,9 @@ RSpec.describe Banzai::Pipeline::PlainMarkdownPipeline do it 'converts all reference punctuation to literals' do reference_chars = Banzai::Filter::MarkdownPreEscapeFilter::REFERENCE_CHARACTERS - markdown = reference_chars.split('').map {|char| char.prepend("\\") }.join + markdown = reference_chars.split('').map { |char| char.prepend("\\") }.join punctuation = Banzai::Filter::MarkdownPreEscapeFilter::REFERENCE_CHARACTERS.split('') - punctuation = punctuation.delete_if {|char| char == '&' } + punctuation = punctuation.delete_if { |char| char == '&' } punctuation << '&' result = described_class.call(markdown, project: project) diff --git a/spec/lib/banzai/renderer_spec.rb b/spec/lib/banzai/renderer_spec.rb index d487268da78..ae9cf4c5068 100644 --- a/spec/lib/banzai/renderer_spec.rb +++ b/spec/lib/banzai/renderer_spec.rb @@ -104,7 +104,7 @@ RSpec.describe Banzai::Renderer do describe '#post_process' do let(:context_options) { {} } - let(:html) { 'Consequatur aperiam et nesciunt modi aut assumenda quo id. '} + let(:html) { 'Consequatur aperiam et nesciunt modi aut assumenda quo id. ' } let(:post_processed_html) { double(html_safe: 'safe doc') } let(:doc) { double(to_html: post_processed_html) } diff --git a/spec/lib/bitbucket_server/connection_spec.rb b/spec/lib/bitbucket_server/connection_spec.rb index 873eded58d7..ae73955e1d1 100644 --- a/spec/lib/bitbucket_server/connection_spec.rb +++ b/spec/lib/bitbucket_server/connection_spec.rb @@ -64,7 +64,7 @@ RSpec.describe BitbucketServer::Connection do context 'branch API' do let(:branch_path) { '/projects/foo/repos/bar/branches' } let(:branch_url) { 'https://test:7990/rest/branch-utils/1.0/projects/foo/repos/bar/branches' } - let(:path) { } + let(:path) {} it 'returns JSON body' do WebMock.stub_request(:delete, branch_url).with(headers: headers).to_return(body: payload.to_json, status: 200, headers: headers) diff --git a/spec/lib/bulk_imports/common/pipelines/lfs_objects_pipeline_spec.rb b/spec/lib/bulk_imports/common/pipelines/lfs_objects_pipeline_spec.rb index b769aa4af5a..f0b461e518e 100644 --- a/spec/lib/bulk_imports/common/pipelines/lfs_objects_pipeline_spec.rb +++ b/spec/lib/bulk_imports/common/pipelines/lfs_objects_pipeline_spec.rb @@ -11,8 +11,8 @@ RSpec.describe BulkImports::Common::Pipelines::LfsObjectsPipeline do let(:tracker) { create(:bulk_import_tracker, entity: entity) } let(:context) { BulkImports::Pipeline::Context.new(tracker) } let(:lfs_dir_path) { tmpdir } - let(:lfs_json_file_path) { File.join(lfs_dir_path, 'lfs_objects.json')} - let(:lfs_file_path) { File.join(lfs_dir_path, oid)} + let(:lfs_json_file_path) { File.join(lfs_dir_path, 'lfs_objects.json') } + let(:lfs_file_path) { File.join(lfs_dir_path, oid) } subject(:pipeline) { described_class.new(context) } diff --git a/spec/lib/bulk_imports/common/pipelines/uploads_pipeline_spec.rb b/spec/lib/bulk_imports/common/pipelines/uploads_pipeline_spec.rb index 9d43bb3ebfb..f650e931dc7 100644 --- a/spec/lib/bulk_imports/common/pipelines/uploads_pipeline_spec.rb +++ b/spec/lib/bulk_imports/common/pipelines/uploads_pipeline_spec.rb @@ -8,7 +8,7 @@ RSpec.describe BulkImports::Common::Pipelines::UploadsPipeline do let(:tmpdir) { Dir.mktmpdir } let(:uploads_dir_path) { File.join(tmpdir, '72a497a02fe3ee09edae2ed06d390038') } - let(:upload_file_path) { File.join(uploads_dir_path, 'upload.txt')} + let(:upload_file_path) { File.join(uploads_dir_path, 'upload.txt') } let(:tracker) { create(:bulk_import_tracker, entity: entity) } let(:context) { BulkImports::Pipeline::Context.new(tracker) } diff --git a/spec/lib/bulk_imports/projects/pipelines/releases_pipeline_spec.rb b/spec/lib/bulk_imports/projects/pipelines/releases_pipeline_spec.rb index 2633598b48d..a376cdd712c 100644 --- a/spec/lib/bulk_imports/projects/pipelines/releases_pipeline_spec.rb +++ b/spec/lib/bulk_imports/projects/pipelines/releases_pipeline_spec.rb @@ -77,7 +77,7 @@ RSpec.describe BulkImports::Projects::Pipelines::ReleasesPipeline do } end - let(:attributes) {{ 'links' => [link] }} + let(:attributes) { { 'links' => [link] } } it 'restores release links' do pipeline.run @@ -106,7 +106,7 @@ RSpec.describe BulkImports::Projects::Pipelines::ReleasesPipeline do } end - let(:attributes) {{ 'milestone_releases' => [{ 'milestone' => milestone }] }} + let(:attributes) { { 'milestone_releases' => [{ 'milestone' => milestone }] } } it 'restores release milestone' do pipeline.run @@ -133,7 +133,7 @@ RSpec.describe BulkImports::Projects::Pipelines::ReleasesPipeline do end context 'when release is historical' do - let(:attributes) {{ 'released_at' => '2018-12-26T10:17:14.621Z' }} + let(:attributes) { { 'released_at' => '2018-12-26T10:17:14.621Z' } } it 'does not create release evidence' do expect(::Releases::CreateEvidenceWorker).not_to receive(:perform_async) @@ -143,7 +143,7 @@ RSpec.describe BulkImports::Projects::Pipelines::ReleasesPipeline do end context 'when release is upcoming' do - let(:attributes) {{ 'released_at' => Time.zone.now + 30.days }} + let(:attributes) { { 'released_at' => Time.zone.now + 30.days } } it 'does not create release evidence' do expect(::Releases::CreateEvidenceWorker).not_to receive(:perform_async) diff --git a/spec/lib/bulk_imports/projects/pipelines/snippets_repository_pipeline_spec.rb b/spec/lib/bulk_imports/projects/pipelines/snippets_repository_pipeline_spec.rb index 9897e74ec7b..4d12b49e2c0 100644 --- a/spec/lib/bulk_imports/projects/pipelines/snippets_repository_pipeline_spec.rb +++ b/spec/lib/bulk_imports/projects/pipelines/snippets_repository_pipeline_spec.rb @@ -7,7 +7,7 @@ RSpec.describe BulkImports::Projects::Pipelines::SnippetsRepositoryPipeline do let(:project) { create(:project) } let(:bulk_import) { create(:bulk_import, user: user) } let(:bulk_import_configuration) { create(:bulk_import_configuration, bulk_import: bulk_import) } - let!(:matched_snippet) { create(:snippet, project: project, created_at: "1981-12-13T23:59:59Z")} + let!(:matched_snippet) { create(:snippet, project: project, created_at: "1981-12-13T23:59:59Z") } let(:entity) do create( :bulk_import_entity, diff --git a/spec/lib/feature_spec.rb b/spec/lib/feature_spec.rb index 4db3f04717b..56e0b4bca30 100644 --- a/spec/lib/feature_spec.rb +++ b/spec/lib/feature_spec.rb @@ -491,8 +491,8 @@ RSpec.describe Feature, stub_feature_flags: false do end shared_examples_for 'logging' do - let(:expected_action) { } - let(:expected_extra) { } + let(:expected_action) {} + let(:expected_extra) {} it 'logs the event' do expect(Feature.logger).to receive(:info).with(key: key, action: expected_action, **expected_extra) diff --git a/spec/lib/gitlab/application_context_spec.rb b/spec/lib/gitlab/application_context_spec.rb index f9e18a65af4..8b2a228b935 100644 --- a/spec/lib/gitlab/application_context_spec.rb +++ b/spec/lib/gitlab/application_context_spec.rb @@ -52,7 +52,7 @@ RSpec.describe Gitlab::ApplicationContext do end it 'raises an error when passing invalid options' do - expect { described_class.push(no: 'option')}.to raise_error(ArgumentError) + expect { described_class.push(no: 'option') }.to raise_error(ArgumentError) end end diff --git a/spec/lib/gitlab/application_rate_limiter_spec.rb b/spec/lib/gitlab/application_rate_limiter_spec.rb index 6f2899d132c..41e79f811fa 100644 --- a/spec/lib/gitlab/application_rate_limiter_spec.rb +++ b/spec/lib/gitlab/application_rate_limiter_spec.rb @@ -209,7 +209,7 @@ RSpec.describe Gitlab::ApplicationRateLimiter, :clean_gitlab_redis_rate_limiting it_behaves_like 'throttles based on key and scope' do let(:threshold) { 1 } - let(:interval) { 2.minutes} + let(:interval) { 2.minutes } end end end diff --git a/spec/lib/gitlab/asciidoc_spec.rb b/spec/lib/gitlab/asciidoc_spec.rb index bfea1315d90..b2bce2076b0 100644 --- a/spec/lib/gitlab/asciidoc_spec.rb +++ b/spec/lib/gitlab/asciidoc_spec.rb @@ -791,7 +791,7 @@ module Gitlab end context 'when the file does not exist' do - it { is_expected.to include("[ERROR: include::#{include_path}[] - unresolved directive]")} + it { is_expected.to include("[ERROR: include::#{include_path}[] - unresolved directive]") } end end diff --git a/spec/lib/gitlab/audit/ci_runner_token_author_spec.rb b/spec/lib/gitlab/audit/ci_runner_token_author_spec.rb index f55e1b44936..89664c57084 100644 --- a/spec/lib/gitlab/audit/ci_runner_token_author_spec.rb +++ b/spec/lib/gitlab/audit/ci_runner_token_author_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Gitlab::Audit::CiRunnerTokenAuthor do describe '.initialize' do subject { described_class.new(audit_event) } - let(:details) { } + let(:details) {} let(:audit_event) { instance_double(AuditEvent, details: details, entity_type: 'Project', entity_path: 'd/e') } context 'with runner_authentication_token' do diff --git a/spec/lib/gitlab/batch_pop_queueing_spec.rb b/spec/lib/gitlab/batch_pop_queueing_spec.rb index 41efc5417e4..5af78ddabe7 100644 --- a/spec/lib/gitlab/batch_pop_queueing_spec.rb +++ b/spec/lib/gitlab/batch_pop_queueing_spec.rb @@ -92,7 +92,7 @@ RSpec.describe Gitlab::BatchPopQueueing do context 'when the queue key does not exist in Redis' do before do - allow(queue).to receive(:enqueue) { } + allow(queue).to receive(:enqueue) {} end it 'yields empty array' do diff --git a/spec/lib/gitlab/chat_name_token_spec.rb b/spec/lib/gitlab/chat_name_token_spec.rb index 906c02d54db..8d5702a6b27 100644 --- a/spec/lib/gitlab/chat_name_token_spec.rb +++ b/spec/lib/gitlab/chat_name_token_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' RSpec.describe Gitlab::ChatNameToken do context 'when using unknown token' do - let(:token) { } + let(:token) {} subject { described_class.new(token).get } diff --git a/spec/lib/gitlab/ci/ansi2html_spec.rb b/spec/lib/gitlab/ci/ansi2html_spec.rb index 27c2b005a93..30359a7170f 100644 --- a/spec/lib/gitlab/ci/ansi2html_spec.rb +++ b/spec/lib/gitlab/ci/ansi2html_spec.rb @@ -210,8 +210,8 @@ RSpec.describe Gitlab::Ci::Ansi2html do let(:section_start_time) { Time.new(2017, 9, 20).utc } let(:section_duration) { 3.seconds } let(:section_end_time) { section_start_time + section_duration } - let(:section_start) { "section_start:#{section_start_time.to_i}:#{section_name}\r\033[0K"} - let(:section_end) { "section_end:#{section_end_time.to_i}:#{section_name}\r\033[0K"} + let(:section_start) { "section_start:#{section_start_time.to_i}:#{section_name}\r\033[0K" } + let(:section_end) { "section_end:#{section_end_time.to_i}:#{section_name}\r\033[0K" } let(:section_start_html) do '<div class="section-start"' \ " data-timestamp=\"#{section_start_time.to_i}\" data-section=\"#{class_name(section_name)}\"" \ @@ -258,13 +258,13 @@ RSpec.describe Gitlab::Ci::Ansi2html do it_behaves_like 'a legit section' context 'section name includes $' do - let(:section_name) { 'my_$ection'} + let(:section_name) { 'my_$ection' } it_behaves_like 'forbidden char in section_name' end context 'section name includes <' do - let(:section_name) { '<a_tag>'} + let(:section_name) { '<a_tag>' } it_behaves_like 'forbidden char in section_name' end diff --git a/spec/lib/gitlab/ci/ansi2json_spec.rb b/spec/lib/gitlab/ci/ansi2json_spec.rb index f9d23ff97bc..4b3b049176f 100644 --- a/spec/lib/gitlab/ci/ansi2json_spec.rb +++ b/spec/lib/gitlab/ci/ansi2json_spec.rb @@ -78,8 +78,8 @@ RSpec.describe Gitlab::Ci::Ansi2json do let(:section_duration) { 63.seconds } let(:section_start_time) { Time.new(2019, 9, 17).utc } let(:section_end_time) { section_start_time + section_duration } - let(:section_start) { "section_start:#{section_start_time.to_i}:#{section_name}\r\033[0K"} - let(:section_end) { "section_end:#{section_end_time.to_i}:#{section_name}\r\033[0K"} + let(:section_start) { "section_start:#{section_start_time.to_i}:#{section_name}\r\033[0K" } + let(:section_end) { "section_end:#{section_end_time.to_i}:#{section_name}\r\033[0K" } it 'marks the first line of the section as header' do expect(convert_json("Hello#{section_start}world!")).to eq([ @@ -258,8 +258,8 @@ RSpec.describe Gitlab::Ci::Ansi2json do let(:nested_section_duration) { 2.seconds } let(:nested_section_start_time) { Time.new(2019, 9, 17).utc } let(:nested_section_end_time) { nested_section_start_time + nested_section_duration } - let(:nested_section_start) { "section_start:#{nested_section_start_time.to_i}:#{nested_section_name}\r\033[0K"} - let(:nested_section_end) { "section_end:#{nested_section_end_time.to_i}:#{nested_section_name}\r\033[0K"} + let(:nested_section_start) { "section_start:#{nested_section_start_time.to_i}:#{nested_section_name}\r\033[0K" } + let(:nested_section_end) { "section_end:#{nested_section_end_time.to_i}:#{nested_section_name}\r\033[0K" } it 'adds multiple sections to the lines inside the nested section' do trace = "Hello#{section_start}foo#{nested_section_start}bar#{nested_section_end}baz#{section_end}world" @@ -342,7 +342,7 @@ RSpec.describe Gitlab::Ci::Ansi2json do end context 'with section options' do - let(:option_section_start) { "section_start:#{section_start_time.to_i}:#{section_name}[collapsed=true,unused_option=123]\r\033[0K"} + let(:option_section_start) { "section_start:#{section_start_time.to_i}:#{section_name}[collapsed=true,unused_option=123]\r\033[0K" } it 'provides section options when set' do trace = "#{option_section_start}hello#{section_end}" @@ -463,8 +463,8 @@ RSpec.describe Gitlab::Ci::Ansi2json do let(:section_duration) { 63.seconds } let(:section_start_time) { Time.new(2019, 9, 17).utc } let(:section_end_time) { section_start_time + section_duration } - let(:section_start) { "section_start:#{section_start_time.to_i}:#{section_name}\r\033[0K"} - let(:section_end) { "section_end:#{section_end_time.to_i}:#{section_name}\r\033[0K"} + let(:section_start) { "section_start:#{section_start_time.to_i}:#{section_name}\r\033[0K" } + let(:section_end) { "section_end:#{section_end_time.to_i}:#{section_name}\r\033[0K" } context 'with split section body' do let(:pre_text) { "#{section_start}this is a header\nand " } diff --git a/spec/lib/gitlab/ci/build/prerequisite/kubernetes_namespace_spec.rb b/spec/lib/gitlab/ci/build/prerequisite/kubernetes_namespace_spec.rb index 94c14cfa479..baabab73ea2 100644 --- a/spec/lib/gitlab/ci/build/prerequisite/kubernetes_namespace_spec.rb +++ b/spec/lib/gitlab/ci/build/prerequisite/kubernetes_namespace_spec.rb @@ -74,7 +74,7 @@ RSpec.describe Gitlab::Ci::Build::Prerequisite::KubernetesNamespace do end context 'kubernetes namespace does not exist' do - let(:namespace_builder) { double(execute: kubernetes_namespace)} + let(:namespace_builder) { double(execute: kubernetes_namespace) } before do allow(Clusters::KubernetesNamespaceFinder).to receive(:new) diff --git a/spec/lib/gitlab/ci/config/entry/processable_spec.rb b/spec/lib/gitlab/ci/config/entry/processable_spec.rb index 5b9337ede34..714b0a3b6aa 100644 --- a/spec/lib/gitlab/ci/config/entry/processable_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/processable_spec.rb @@ -212,7 +212,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Processable do let(:unspecified) { double('unspecified', 'specified?' => false) } let(:default) { double('default', '[]' => unspecified) } let(:workflow) { double('workflow', 'has_rules?' => false) } - let(:variables) { } + let(:variables) {} let(:deps) do double('deps', diff --git a/spec/lib/gitlab/ci/config/entry/release_spec.rb b/spec/lib/gitlab/ci/config/entry/release_spec.rb index a0c0ced9b8a..7b6b31ca748 100644 --- a/spec/lib/gitlab/ci/config/entry/release_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/release_spec.rb @@ -128,25 +128,25 @@ RSpec.describe Gitlab::Ci::Config::Entry::Release do end context "when 'ref' is a short commit SHA" do - let(:ref) { 'b3235930'} + let(:ref) { 'b3235930' } it_behaves_like 'a valid entry' end context "when 'ref' is a branch name" do - let(:ref) { 'fix/123-branch-name'} + let(:ref) { 'fix/123-branch-name' } it_behaves_like 'a valid entry' end context "when 'ref' is a semantic versioning tag" do - let(:ref) { 'v1.2.3'} + let(:ref) { 'v1.2.3' } it_behaves_like 'a valid entry' end context "when 'ref' is a semantic versioning tag rc" do - let(:ref) { 'v1.2.3-rc'} + let(:ref) { 'v1.2.3-rc' } it_behaves_like 'a valid entry' end diff --git a/spec/lib/gitlab/ci/config/entry/tags_spec.rb b/spec/lib/gitlab/ci/config/entry/tags_spec.rb index e05d4ae52b2..24efd08c855 100644 --- a/spec/lib/gitlab/ci/config/entry/tags_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/tags_spec.rb @@ -34,7 +34,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Tags do end context 'when tags limit is reached' do - let(:config) { Array.new(50) {|i| "tag-#{i}" } } + let(:config) { Array.new(50) { |i| "tag-#{i}" } } it 'reports error' do expect(entry.errors) diff --git a/spec/lib/gitlab/ci/config/external/file/base_spec.rb b/spec/lib/gitlab/ci/config/external/file/base_spec.rb index 280bebe1a7c..1306d61d99c 100644 --- a/spec/lib/gitlab/ci/config/external/file/base_spec.rb +++ b/spec/lib/gitlab/ci/config/external/file/base_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe Gitlab::Ci::Config::External::File::Base do - let(:variables) { } + let(:variables) {} let(:context_params) { { sha: 'HEAD', variables: variables } } let(:context) { Gitlab::Ci::Config::External::Context.new(**context_params) } @@ -100,7 +100,7 @@ RSpec.describe Gitlab::Ci::Config::External::File::Base do describe '#to_hash' do context 'with includes' do let(:location) { 'some/file/config.yml' } - let(:content) { 'include: { template: Bash.gitlab-ci.yml }'} + let(:content) { 'include: { template: Bash.gitlab-ci.yml }' } before do allow_any_instance_of(test_class) diff --git a/spec/lib/gitlab/ci/config/external/file/local_spec.rb b/spec/lib/gitlab/ci/config/external/file/local_spec.rb index 0e78498c98e..f5b36ebfa45 100644 --- a/spec/lib/gitlab/ci/config/external/file/local_spec.rb +++ b/spec/lib/gitlab/ci/config/external/file/local_spec.rb @@ -167,7 +167,7 @@ RSpec.describe Gitlab::Ci::Config::External::File::Local do describe '#to_hash' do context 'properly includes another local file in the same repository' do let(:location) { 'some/file/config.yml' } - let(:content) { 'include: { local: another-config.yml }'} + let(:content) { 'include: { local: another-config.yml }' } let(:another_location) { 'another-config.yml' } let(:another_content) { 'rspec: JOB' } diff --git a/spec/lib/gitlab/ci/config/external/file/remote_spec.rb b/spec/lib/gitlab/ci/config/external/file/remote_spec.rb index 3e1c4df4e32..45dfea636f3 100644 --- a/spec/lib/gitlab/ci/config/external/file/remote_spec.rb +++ b/spec/lib/gitlab/ci/config/external/file/remote_spec.rb @@ -5,7 +5,7 @@ require 'spec_helper' RSpec.describe Gitlab::Ci::Config::External::File::Remote do include StubRequests - let(:variables) {Gitlab::Ci::Variables::Collection.new([{ 'key' => 'GITLAB_TOKEN', 'value' => 'secret_file', 'masked' => true }]) } + let(:variables) { Gitlab::Ci::Variables::Collection.new([{ 'key' => 'GITLAB_TOKEN', 'value' => 'secret_file', 'masked' => true }]) } let(:context_params) { { sha: '12345', variables: variables } } let(:context) { Gitlab::Ci::Config::External::Context.new(**context_params) } let(:params) { { remote: location } } diff --git a/spec/lib/gitlab/ci/config/normalizer_spec.rb b/spec/lib/gitlab/ci/config/normalizer_spec.rb index 354392eb42e..96ca5d98a6e 100644 --- a/spec/lib/gitlab/ci/config/normalizer_spec.rb +++ b/spec/lib/gitlab/ci/config/normalizer_spec.rb @@ -232,7 +232,7 @@ RSpec.describe Gitlab::Ci::Config::Normalizer do context 'when parallel config does not matches a factory' do let(:variables_config) { {} } - let(:parallel_config) { } + let(:parallel_config) {} it 'does not alter the job config' do is_expected.to match(config) diff --git a/spec/lib/gitlab/ci/cron_parser_spec.rb b/spec/lib/gitlab/ci/cron_parser_spec.rb index 4017accb462..33474865a93 100644 --- a/spec/lib/gitlab/ci/cron_parser_spec.rb +++ b/spec/lib/gitlab/ci/cron_parser_spec.rb @@ -178,7 +178,7 @@ RSpec.describe Gitlab::Ci::CronParser do end context 'when time crosses a Daylight Savings boundary' do - let(:cron) { '* 0 1 12 *'} + let(:cron) { '* 0 1 12 *' } # Note this previously only failed if the time zone is set # to a zone that observes Daylight Savings diff --git a/spec/lib/gitlab/ci/pipeline/chain/create_deployments_spec.rb b/spec/lib/gitlab/ci/pipeline/chain/create_deployments_spec.rb index cbf92f8fa83..be5d3a96126 100644 --- a/spec/lib/gitlab/ci/pipeline/chain/create_deployments_spec.rb +++ b/spec/lib/gitlab/ci/pipeline/chain/create_deployments_spec.rb @@ -39,7 +39,7 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::CreateDeployments do end context 'when the corresponding environment does not exist' do - let!(:environment) { } + let!(:environment) {} it 'does not create a deployment record' do expect { subject }.not_to change { Deployment.count } diff --git a/spec/lib/gitlab/ci/pipeline/chain/seed_block_spec.rb b/spec/lib/gitlab/ci/pipeline/chain/seed_block_spec.rb index fabfbd779f3..5ee96b0baa8 100644 --- a/spec/lib/gitlab/ci/pipeline/chain/seed_block_spec.rb +++ b/spec/lib/gitlab/ci/pipeline/chain/seed_block_spec.rb @@ -5,7 +5,7 @@ require 'spec_helper' RSpec.describe Gitlab::Ci::Pipeline::Chain::SeedBlock do let(:project) { create(:project, :repository) } let(:user) { create(:user, developer_projects: [project]) } - let(:seeds_block) { } + let(:seeds_block) {} let(:command) do Gitlab::Ci::Pipeline::Chain::Command.new( diff --git a/spec/lib/gitlab/ci/pipeline/chain/seed_spec.rb b/spec/lib/gitlab/ci/pipeline/chain/seed_spec.rb index 687bb82a8ef..1e73a7efc65 100644 --- a/spec/lib/gitlab/ci/pipeline/chain/seed_spec.rb +++ b/spec/lib/gitlab/ci/pipeline/chain/seed_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Seed do let_it_be(:project) { create(:project, :repository) } let_it_be(:user) { create(:user, developer_projects: [project]) } - let(:seeds_block) { } + let(:seeds_block) {} let(:command) { initialize_command } let(:pipeline) { build(:ci_pipeline, project: project) } diff --git a/spec/lib/gitlab/ci/pipeline/chain/validate/external_spec.rb b/spec/lib/gitlab/ci/pipeline/chain/validate/external_spec.rb index eeac0c85a77..c19756c4783 100644 --- a/spec/lib/gitlab/ci/pipeline/chain/validate/external_spec.rb +++ b/spec/lib/gitlab/ci/pipeline/chain/validate/external_spec.rb @@ -243,7 +243,7 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Validate::External do end context 'when save_incompleted is false' do - let(:save_incompleted) { false} + let(:save_incompleted) { false } it 'adds errors to the pipeline without dropping it' do perform! diff --git a/spec/lib/gitlab/ci/pipeline/quota/deployments_spec.rb b/spec/lib/gitlab/ci/pipeline/quota/deployments_spec.rb index 8f727749ee2..a742c619584 100644 --- a/spec/lib/gitlab/ci/pipeline/quota/deployments_spec.rb +++ b/spec/lib/gitlab/ci/pipeline/quota/deployments_spec.rb @@ -9,7 +9,7 @@ RSpec.describe Gitlab::Ci::Pipeline::Quota::Deployments do let(:pipeline) { build_stubbed(:ci_pipeline, project: project) } - let(:pipeline_seed) { double(:pipeline_seed, deployments_count: 2)} + let(:pipeline_seed) { double(:pipeline_seed, deployments_count: 2) } let(:command) do double(:command, diff --git a/spec/lib/gitlab/ci/reports/security/reports_spec.rb b/spec/lib/gitlab/ci/reports/security/reports_spec.rb index 79eee642552..e240edc4a12 100644 --- a/spec/lib/gitlab/ci/reports/security/reports_spec.rb +++ b/spec/lib/gitlab/ci/reports/security/reports_spec.rb @@ -57,7 +57,7 @@ RSpec.describe Gitlab::Ci::Reports::Security::Reports do let(:high_severity_dast) { build(:ci_reports_security_finding, severity: 'high', report_type: 'dast') } let(:vulnerabilities_allowed) { 0 } let(:severity_levels) { %w(critical high) } - let(:vulnerability_states) { %w(newly_detected)} + let(:vulnerability_states) { %w(newly_detected) } subject { security_reports.violates_default_policy_against?(target_reports, vulnerabilities_allowed, severity_levels, vulnerability_states) } diff --git a/spec/lib/gitlab/ci/reports/security/vulnerability_reports_comparer_spec.rb b/spec/lib/gitlab/ci/reports/security/vulnerability_reports_comparer_spec.rb index 44e66fd9028..6f75e2c55e8 100644 --- a/spec/lib/gitlab/ci/reports/security/vulnerability_reports_comparer_spec.rb +++ b/spec/lib/gitlab/ci/reports/security/vulnerability_reports_comparer_spec.rb @@ -60,7 +60,7 @@ RSpec.describe Gitlab::Ci::Reports::Security::VulnerabilityReportsComparer do end describe '#added' do - let(:new_location) {build(:ci_reports_security_locations_sast, :dynamic) } + let(:new_location) { build(:ci_reports_security_locations_sast, :dynamic) } let(:vul_params) { vuln_params(project.id, [identifier], confidence: :high) } let(:vuln) { build(:ci_reports_security_finding, severity: Enums::Vulnerability.severity_levels[:critical], location: new_location, **vul_params) } let(:low_vuln) { build(:ci_reports_security_finding, severity: Enums::Vulnerability.severity_levels[:low], location: new_location, **vul_params) } diff --git a/spec/lib/gitlab/ci/reports/test_suite_spec.rb b/spec/lib/gitlab/ci/reports/test_suite_spec.rb index 1d6b39a7831..4a1f77bed65 100644 --- a/spec/lib/gitlab/ci/reports/test_suite_spec.rb +++ b/spec/lib/gitlab/ci/reports/test_suite_spec.rb @@ -91,7 +91,7 @@ RSpec.describe Gitlab::Ci::Reports::TestSuite do subject { test_suite.with_attachment! } context 'when test cases do not contain an attachment' do - let(:test_case) { build(:report_test_case, :failed)} + let(:test_case) { build(:report_test_case, :failed) } before do test_suite.add_test_case(test_case) @@ -103,7 +103,7 @@ RSpec.describe Gitlab::Ci::Reports::TestSuite do end context 'when test cases contain an attachment' do - let(:test_case_with_attachment) { build(:report_test_case, :failed_with_attachment)} + let(:test_case_with_attachment) { build(:report_test_case, :failed_with_attachment) } before do test_suite.add_test_case(test_case_with_attachment) diff --git a/spec/lib/gitlab/ci/runner_releases_spec.rb b/spec/lib/gitlab/ci/runner_releases_spec.rb index 576eb02ad83..1cc582cf972 100644 --- a/spec/lib/gitlab/ci/runner_releases_spec.rb +++ b/spec/lib/gitlab/ci/runner_releases_spec.rb @@ -113,7 +113,7 @@ RSpec.describe Gitlab::Ci::RunnerReleases do end context 'when request results in timeout' do - let(:response) { } + let(:response) {} let(:expected_releases) { nil } let(:expected_releases_by_minor) { nil } diff --git a/spec/lib/gitlab/ci/status/build/canceled_spec.rb b/spec/lib/gitlab/ci/status/build/canceled_spec.rb index e30a2211c8f..519b970ca5e 100644 --- a/spec/lib/gitlab/ci/status/build/canceled_spec.rb +++ b/spec/lib/gitlab/ci/status/build/canceled_spec.rb @@ -14,7 +14,7 @@ RSpec.describe Gitlab::Ci::Status::Build::Canceled do end describe '.matches?' do - subject {described_class.matches?(build, user) } + subject { described_class.matches?(build, user) } context 'when build is canceled' do let(:build) { create(:ci_build, :canceled) } diff --git a/spec/lib/gitlab/ci/status/build/created_spec.rb b/spec/lib/gitlab/ci/status/build/created_spec.rb index 49468674140..9738b3c1f36 100644 --- a/spec/lib/gitlab/ci/status/build/created_spec.rb +++ b/spec/lib/gitlab/ci/status/build/created_spec.rb @@ -14,7 +14,7 @@ RSpec.describe Gitlab::Ci::Status::Build::Created do end describe '.matches?' do - subject {described_class.matches?(build, user) } + subject { described_class.matches?(build, user) } context 'when build is created' do let(:build) { create(:ci_build, :created) } diff --git a/spec/lib/gitlab/ci/status/build/manual_spec.rb b/spec/lib/gitlab/ci/status/build/manual_spec.rb index 150705c1e36..a1152cb77e3 100644 --- a/spec/lib/gitlab/ci/status/build/manual_spec.rb +++ b/spec/lib/gitlab/ci/status/build/manual_spec.rb @@ -27,7 +27,7 @@ RSpec.describe Gitlab::Ci::Status::Build::Manual do end describe '.matches?' do - subject {described_class.matches?(build, user) } + subject { described_class.matches?(build, user) } context 'when build is manual' do let(:build) { create(:ci_build, :manual) } diff --git a/spec/lib/gitlab/ci/status/build/pending_spec.rb b/spec/lib/gitlab/ci/status/build/pending_spec.rb index 7b695d33877..b7dda9ce9c9 100644 --- a/spec/lib/gitlab/ci/status/build/pending_spec.rb +++ b/spec/lib/gitlab/ci/status/build/pending_spec.rb @@ -14,7 +14,7 @@ RSpec.describe Gitlab::Ci::Status::Build::Pending do end describe '.matches?' do - subject {described_class.matches?(build, user) } + subject { described_class.matches?(build, user) } context 'when build is pending' do let(:build) { create(:ci_build, :pending) } diff --git a/spec/lib/gitlab/ci/status/build/skipped_spec.rb b/spec/lib/gitlab/ci/status/build/skipped_spec.rb index 0b998a52a57..4437ac0089f 100644 --- a/spec/lib/gitlab/ci/status/build/skipped_spec.rb +++ b/spec/lib/gitlab/ci/status/build/skipped_spec.rb @@ -14,7 +14,7 @@ RSpec.describe Gitlab::Ci::Status::Build::Skipped do end describe '.matches?' do - subject {described_class.matches?(build, user) } + subject { described_class.matches?(build, user) } context 'when build is skipped' do let(:build) { create(:ci_build, :skipped) } diff --git a/spec/lib/gitlab/ci/status/processable/waiting_for_resource_spec.rb b/spec/lib/gitlab/ci/status/processable/waiting_for_resource_spec.rb index 91a9724d043..26087fd771c 100644 --- a/spec/lib/gitlab/ci/status/processable/waiting_for_resource_spec.rb +++ b/spec/lib/gitlab/ci/status/processable/waiting_for_resource_spec.rb @@ -15,7 +15,7 @@ RSpec.describe Gitlab::Ci::Status::Processable::WaitingForResource do end describe '.matches?' do - subject {described_class.matches?(processable, user) } + subject { described_class.matches?(processable, user) } context 'when processable is waiting for resource' do let(:processable) { create(:ci_build, :waiting_for_resource) } diff --git a/spec/lib/gitlab/ci/templates/auto_devops_gitlab_ci_yaml_spec.rb b/spec/lib/gitlab/ci/templates/auto_devops_gitlab_ci_yaml_spec.rb index 78d3982a79f..1a909f52ec3 100644 --- a/spec/lib/gitlab/ci/templates/auto_devops_gitlab_ci_yaml_spec.rb +++ b/spec/lib/gitlab/ci/templates/auto_devops_gitlab_ci_yaml_spec.rb @@ -44,7 +44,7 @@ RSpec.describe 'Auto-DevOps.gitlab-ci.yml' do context 'when the project is set for deployment to AWS' do let(:platform_value) { 'ECS' } - let(:review_prod_build_names) { build_names.select {|n| n.include?('review') || n.include?('production')} } + let(:review_prod_build_names) { build_names.select { |n| n.include?('review') || n.include?('production') } } before do create(:ci_variable, project: project, key: 'AUTO_DEVOPS_PLATFORM_TARGET', value: platform_value) diff --git a/spec/lib/gitlab/ci/trace/remote_checksum_spec.rb b/spec/lib/gitlab/ci/trace/remote_checksum_spec.rb index 1cd88034166..be29543676f 100644 --- a/spec/lib/gitlab/ci/trace/remote_checksum_spec.rb +++ b/spec/lib/gitlab/ci/trace/remote_checksum_spec.rb @@ -47,7 +47,7 @@ RSpec.describe Gitlab::Ci::Trace::RemoteChecksum do end context 'when the response does not include :content_md5' do - let(:metadata) {{}} + let(:metadata) { {} } it 'raises an exception' do expect { subject }.to raise_error KeyError, /content_md5/ @@ -55,7 +55,7 @@ RSpec.describe Gitlab::Ci::Trace::RemoteChecksum do end context 'when the response include :content_md5' do - let(:metadata) {{ content_md5: base64checksum }} + let(:metadata) { { content_md5: base64checksum } } it { is_expected.to eq(checksum) } end diff --git a/spec/lib/gitlab/ci/yaml_processor_spec.rb b/spec/lib/gitlab/ci/yaml_processor_spec.rb index eef707a0495..35af9ae6201 100644 --- a/spec/lib/gitlab/ci/yaml_processor_spec.rb +++ b/spec/lib/gitlab/ci/yaml_processor_spec.rb @@ -1425,7 +1425,7 @@ module Gitlab it 'returns the parallel config' do build_options = builds.map { |build| build[:options] } parallel_config = { - matrix: parallel[:matrix].map { |var| var.transform_values { |v| Array(v).flatten }}, + matrix: parallel[:matrix].map { |var| var.transform_values { |v| Array(v).flatten } }, total: build_options.size } @@ -1957,7 +1957,7 @@ module Gitlab subject { Gitlab::Ci::YamlProcessor.new(YAML.dump(config)).execute } context 'no dependencies' do - let(:dependencies) { } + let(:dependencies) {} it { is_expected.to be_valid } end @@ -2013,8 +2013,8 @@ module Gitlab end describe "Job Needs" do - let(:needs) { } - let(:dependencies) { } + let(:needs) {} + let(:dependencies) {} let(:config) do { diff --git a/spec/lib/gitlab/composer/cache_spec.rb b/spec/lib/gitlab/composer/cache_spec.rb index 071771960c6..a4d632da848 100644 --- a/spec/lib/gitlab/composer/cache_spec.rb +++ b/spec/lib/gitlab/composer/cache_spec.rb @@ -31,7 +31,7 @@ RSpec.describe Gitlab::Composer::Cache do cache_file = Packages::Composer::CacheFile.last freeze_time do - expect { subject }.to change { cache_file.reload.delete_at}.from(nil).to(1.day.from_now) + expect { subject }.to change { cache_file.reload.delete_at }.from(nil).to(1.day.from_now) end end end diff --git a/spec/lib/gitlab/data_builder/build_spec.rb b/spec/lib/gitlab/data_builder/build_spec.rb index 9cee0802e87..d089493be19 100644 --- a/spec/lib/gitlab/data_builder/build_spec.rb +++ b/spec/lib/gitlab/data_builder/build_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' RSpec.describe Gitlab::DataBuilder::Build do let!(:tag_names) { %w(tag-1 tag-2) } - let(:runner) { create(:ci_runner, :instance, tag_list: tag_names.map { |n| ActsAsTaggableOn::Tag.create!(name: n)}) } + let(:runner) { create(:ci_runner, :instance, tag_list: tag_names.map { |n| ActsAsTaggableOn::Tag.create!(name: n) }) } let(:user) { create(:user, :public_email) } let(:build) { create(:ci_build, :running, runner: runner, user: user) } diff --git a/spec/lib/gitlab/data_builder/pipeline_spec.rb b/spec/lib/gitlab/data_builder/pipeline_spec.rb index 469812c80fc..86a1539a836 100644 --- a/spec/lib/gitlab/data_builder/pipeline_spec.rb +++ b/spec/lib/gitlab/data_builder/pipeline_spec.rb @@ -54,7 +54,7 @@ RSpec.describe Gitlab::DataBuilder::Pipeline do context 'build with runner' do let_it_be(:tag_names) { %w(tag-1 tag-2) } - let_it_be(:ci_runner) { create(:ci_runner, tag_list: tag_names.map { |n| ActsAsTaggableOn::Tag.create!(name: n)}) } + let_it_be(:ci_runner) { create(:ci_runner, tag_list: tag_names.map { |n| ActsAsTaggableOn::Tag.create!(name: n) }) } let_it_be(:build) { create(:ci_build, pipeline: pipeline, runner: ci_runner) } it 'has runner attributes', :aggregate_failures do diff --git a/spec/lib/gitlab/database/background_migration/batched_migration_spec.rb b/spec/lib/gitlab/database/background_migration/batched_migration_spec.rb index 55f607c0cb0..9b5bcdf4af9 100644 --- a/spec/lib/gitlab/database/background_migration/batched_migration_spec.rb +++ b/spec/lib/gitlab/database/background_migration/batched_migration_spec.rb @@ -307,7 +307,7 @@ RSpec.describe Gitlab::Database::BackgroundMigration::BatchedMigration, type: :m end describe '#batch_class' do - let(:batch_class) { Gitlab::BackgroundMigration::BatchingStrategies::PrimaryKeyBatchingStrategy} + let(:batch_class) { Gitlab::BackgroundMigration::BatchingStrategies::PrimaryKeyBatchingStrategy } let(:batched_migration) { build(:batched_background_migration) } it 'returns the class of the batch strategy for the migration' do diff --git a/spec/lib/gitlab/database/load_balancing/load_balancer_spec.rb b/spec/lib/gitlab/database/load_balancing/load_balancer_spec.rb index 90b588750dd..9c09253b24c 100644 --- a/spec/lib/gitlab/database/load_balancing/load_balancer_spec.rb +++ b/spec/lib/gitlab/database/load_balancing/load_balancer_spec.rb @@ -408,7 +408,7 @@ RSpec.describe Gitlab::Database::LoadBalancing::LoadBalancer, :request_store do end describe '#select_up_to_date_host' do - let(:location) { 'AB/12345'} + let(:location) { 'AB/12345' } let(:hosts) { lb.host_list.hosts } let(:set_host) { request_cache[described_class::CACHE_KEY] } @@ -459,7 +459,7 @@ RSpec.describe Gitlab::Database::LoadBalancing::LoadBalancer, :request_store do end it 'does not modify connection class pool' do - expect { with_replica_pool(5) { } }.not_to change { ActiveRecord::Base.connection_pool } + expect { with_replica_pool(5) {} }.not_to change { ActiveRecord::Base.connection_pool } end def with_replica_pool(*args) diff --git a/spec/lib/gitlab/database/load_balancing/sidekiq_server_middleware_spec.rb b/spec/lib/gitlab/database/load_balancing/sidekiq_server_middleware_spec.rb index 31be3963565..8053bd57bba 100644 --- a/spec/lib/gitlab/database/load_balancing/sidekiq_server_middleware_spec.rb +++ b/spec/lib/gitlab/database/load_balancing/sidekiq_server_middleware_spec.rb @@ -5,7 +5,7 @@ require 'spec_helper' RSpec.describe Gitlab::Database::LoadBalancing::SidekiqServerMiddleware, :clean_gitlab_redis_queues do let(:middleware) { described_class.new } let(:worker) { worker_class.new } - let(:location) {'0/D525E3A8' } + let(:location) { '0/D525E3A8' } let(:wal_locations) { { Gitlab::Database::MAIN_DATABASE_NAME.to_sym => location } } let(:job) { { "retry" => 3, "job_id" => "a180b47c-3fd6-41b8-81e9-34da61c3400e", 'wal_locations' => wal_locations } } diff --git a/spec/lib/gitlab/database/migration_helpers/v2_spec.rb b/spec/lib/gitlab/database/migration_helpers/v2_spec.rb index 5c054795697..2055dc33d48 100644 --- a/spec/lib/gitlab/database/migration_helpers/v2_spec.rb +++ b/spec/lib/gitlab/database/migration_helpers/v2_spec.rb @@ -266,7 +266,7 @@ RSpec.describe Gitlab::Database::MigrationHelpers::V2 do let(:env) { { 'DISABLE_LOCK_RETRIES' => 'true' } } it 'sets the migration class name in the logs' do - model.with_lock_retries(env: env, logger: in_memory_logger) { } + model.with_lock_retries(env: env, logger: in_memory_logger) {} buffer.rewind expect(buffer.read).to include("\"class\":\"#{model.class}\"") @@ -280,7 +280,7 @@ RSpec.describe Gitlab::Database::MigrationHelpers::V2 do expect(Gitlab::Database::WithLockRetries).to receive(:new).and_return(with_lock_retries) expect(with_lock_retries).to receive(:run).with(raise_on_exhaustion: raise_on_exhaustion) - model.with_lock_retries(env: env, logger: in_memory_logger, raise_on_exhaustion: raise_on_exhaustion) { } + model.with_lock_retries(env: env, logger: in_memory_logger, raise_on_exhaustion: raise_on_exhaustion) {} end end @@ -289,7 +289,7 @@ RSpec.describe Gitlab::Database::MigrationHelpers::V2 do expect(Gitlab::Database::WithLockRetries).to receive(:new).and_return(with_lock_retries) expect(with_lock_retries).to receive(:run).with(raise_on_exhaustion: false) - model.with_lock_retries(env: env, logger: in_memory_logger) { } + model.with_lock_retries(env: env, logger: in_memory_logger) {} end it 'defaults to disallowing subtransactions' do @@ -297,7 +297,7 @@ RSpec.describe Gitlab::Database::MigrationHelpers::V2 do expect(Gitlab::Database::WithLockRetries).to receive(:new).with(hash_including(allow_savepoints: false)).and_return(with_lock_retries) expect(with_lock_retries).to receive(:run).with(raise_on_exhaustion: false) - model.with_lock_retries(env: env, logger: in_memory_logger) { } + model.with_lock_retries(env: env, logger: in_memory_logger) {} end context 'when in transaction' do @@ -323,7 +323,7 @@ RSpec.describe Gitlab::Database::MigrationHelpers::V2 do end it 'raises an error' do - expect { model.with_lock_retries(env: env, logger: in_memory_logger) { } }.to raise_error /can not be run inside an already open transaction/ + expect { model.with_lock_retries(env: env, logger: in_memory_logger) {} }.to raise_error /can not be run inside an already open transaction/ end end end diff --git a/spec/lib/gitlab/database/migration_helpers_spec.rb b/spec/lib/gitlab/database/migration_helpers_spec.rb index 091e8dcd8b4..8077515f478 100644 --- a/spec/lib/gitlab/database/migration_helpers_spec.rb +++ b/spec/lib/gitlab/database/migration_helpers_spec.rb @@ -2447,7 +2447,7 @@ RSpec.describe Gitlab::Database::MigrationHelpers do let(:env) { { 'DISABLE_LOCK_RETRIES' => 'true' } } it 'sets the migration class name in the logs' do - model.with_lock_retries(env: env, logger: in_memory_logger) { } + model.with_lock_retries(env: env, logger: in_memory_logger) {} buffer.rewind expect(buffer.read).to include("\"class\":\"#{model.class}\"") @@ -2461,7 +2461,7 @@ RSpec.describe Gitlab::Database::MigrationHelpers do expect(Gitlab::Database::WithLockRetries).to receive(:new).and_return(with_lock_retries) expect(with_lock_retries).to receive(:run).with(raise_on_exhaustion: raise_on_exhaustion) - model.with_lock_retries(env: env, logger: in_memory_logger, raise_on_exhaustion: raise_on_exhaustion) { } + model.with_lock_retries(env: env, logger: in_memory_logger, raise_on_exhaustion: raise_on_exhaustion) {} end end @@ -2470,7 +2470,7 @@ RSpec.describe Gitlab::Database::MigrationHelpers do expect(Gitlab::Database::WithLockRetries).to receive(:new).and_return(with_lock_retries) expect(with_lock_retries).to receive(:run).with(raise_on_exhaustion: false) - model.with_lock_retries(env: env, logger: in_memory_logger) { } + model.with_lock_retries(env: env, logger: in_memory_logger) {} end it 'defaults to allowing subtransactions' do @@ -2479,7 +2479,7 @@ RSpec.describe Gitlab::Database::MigrationHelpers do expect(Gitlab::Database::WithLockRetries).to receive(:new).with(hash_including(allow_savepoints: true)).and_return(with_lock_retries) expect(with_lock_retries).to receive(:run).with(raise_on_exhaustion: false) - model.with_lock_retries(env: env, logger: in_memory_logger) { } + model.with_lock_retries(env: env, logger: in_memory_logger) {} end end diff --git a/spec/lib/gitlab/database/migrations/lock_retry_mixin_spec.rb b/spec/lib/gitlab/database/migrations/lock_retry_mixin_spec.rb index 50ad77caaf1..6092d985ce8 100644 --- a/spec/lib/gitlab/database/migrations/lock_retry_mixin_spec.rb +++ b/spec/lib/gitlab/database/migrations/lock_retry_mixin_spec.rb @@ -83,10 +83,10 @@ RSpec.describe Gitlab::Database::Migrations::LockRetryMixin do context 'with transactions disabled' do let(:migration) { double('migration', enable_lock_retries?: false) } - let(:receiver) { double('receiver', use_transaction?: false)} + let(:receiver) { double('receiver', use_transaction?: false) } it 'calls super method' do - p = proc { } + p = proc {} expect(receiver).to receive(:ddl_transaction).with(migration, &p) @@ -95,11 +95,11 @@ RSpec.describe Gitlab::Database::Migrations::LockRetryMixin do end context 'with transactions enabled, but lock retries disabled' do - let(:receiver) { double('receiver', use_transaction?: true)} + let(:receiver) { double('receiver', use_transaction?: true) } let(:migration) { double('migration', enable_lock_retries?: false) } it 'calls super method' do - p = proc { } + p = proc {} expect(receiver).to receive(:ddl_transaction).with(migration, &p) @@ -108,12 +108,12 @@ RSpec.describe Gitlab::Database::Migrations::LockRetryMixin do end context 'with transactions enabled and lock retries enabled' do - let(:receiver) { double('receiver', use_transaction?: true)} + let(:receiver) { double('receiver', use_transaction?: true) } let(:migration) { double('migration', migration_connection: connection, enable_lock_retries?: true) } let(:connection) { ActiveRecord::Base.connection } it 'calls super method' do - p = proc { } + p = proc {} expect(receiver).not_to receive(:ddl_transaction) expect_next_instance_of(Gitlab::Database::WithLockRetries) do |retries| diff --git a/spec/lib/gitlab/database/migrations/runner_spec.rb b/spec/lib/gitlab/database/migrations/runner_spec.rb index e7f68e3e4a8..a37247ba0c6 100644 --- a/spec/lib/gitlab/database/migrations/runner_spec.rb +++ b/spec/lib/gitlab/database/migrations/runner_spec.rb @@ -41,7 +41,7 @@ RSpec.describe Gitlab::Database::Migrations::Runner do allow(described_class).to receive(:migration_context).and_return(ctx) - names_this_branch = (applied_migrations_this_branch + pending_migrations).map { |m| "db/migrate/#{m.version}_#{m.name}.rb"} + names_this_branch = (applied_migrations_this_branch + pending_migrations).map { |m| "db/migrate/#{m.version}_#{m.name}.rb" } allow(described_class).to receive(:migration_file_names_this_branch).and_return(names_this_branch) end diff --git a/spec/lib/gitlab/database/migrations/test_batched_background_runner_spec.rb b/spec/lib/gitlab/database/migrations/test_batched_background_runner_spec.rb index f1f72d71e1a..4a49f0224f0 100644 --- a/spec/lib/gitlab/database/migrations/test_batched_background_runner_spec.rb +++ b/spec/lib/gitlab/database/migrations/test_batched_background_runner_spec.rb @@ -18,7 +18,7 @@ RSpec.describe Gitlab::Database::Migrations::TestBatchedBackgroundRunner, :freez let(:connection) { ApplicationRecord.connection } - let(:table_name) { "_test_column_copying"} + let(:table_name) { "_test_column_copying" } before do connection.execute(<<~SQL) diff --git a/spec/lib/gitlab/database/partitioning_spec.rb b/spec/lib/gitlab/database/partitioning_spec.rb index 7c69f639aab..36c8b0811fe 100644 --- a/spec/lib/gitlab/database/partitioning_spec.rb +++ b/spec/lib/gitlab/database/partitioning_spec.rb @@ -89,7 +89,7 @@ RSpec.describe Gitlab::Database::Partitioning do end it 'manages partitions for each given model' do - expect { described_class.sync_partitions(models)} + expect { described_class.sync_partitions(models) } .to change { find_partitions(table_names.first).size }.from(0) .and change { find_partitions(table_names.last).size }.from(0) end diff --git a/spec/lib/gitlab/database/reindexing/grafana_notifier_spec.rb b/spec/lib/gitlab/database/reindexing/grafana_notifier_spec.rb index 34670696787..1bccdda3be1 100644 --- a/spec/lib/gitlab/database/reindexing/grafana_notifier_spec.rb +++ b/spec/lib/gitlab/database/reindexing/grafana_notifier_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Gitlab::Database::Reindexing::GrafanaNotifier do include Database::DatabaseHelpers let(:api_key) { "foo" } - let(:api_url) { "http://bar"} + let(:api_url) { "http://bar" } let(:additional_tag) { "some-tag" } let(:action) { create(:reindex_action) } diff --git a/spec/lib/gitlab/database/with_lock_retries_outside_transaction_spec.rb b/spec/lib/gitlab/database/with_lock_retries_outside_transaction_spec.rb index 6c32fb3ca17..836332524a9 100644 --- a/spec/lib/gitlab/database/with_lock_retries_outside_transaction_spec.rb +++ b/spec/lib/gitlab/database/with_lock_retries_outside_transaction_spec.rb @@ -232,14 +232,14 @@ RSpec.describe Gitlab::Database::WithLockRetriesOutsideTransaction do expect(connection).to receive(:execute).with('RESET idle_in_transaction_session_timeout; RESET lock_timeout').and_call_original expect(connection).to receive(:execute).with("SET lock_timeout TO '15ms'").and_call_original - subject.run { } + subject.run {} end it 'calls `sleep` after the first iteration fails, using the configured sleep time' do expect(subject).to receive(:run_block_with_lock_timeout).and_raise(ActiveRecord::LockWaitTimeout).twice expect(subject).to receive(:sleep).with(0.025) - subject.run { } + subject.run {} end end end diff --git a/spec/lib/gitlab/database/with_lock_retries_spec.rb b/spec/lib/gitlab/database/with_lock_retries_spec.rb index 6b35ccafabc..797a01c482d 100644 --- a/spec/lib/gitlab/database/with_lock_retries_spec.rb +++ b/spec/lib/gitlab/database/with_lock_retries_spec.rb @@ -248,14 +248,14 @@ RSpec.describe Gitlab::Database::WithLockRetries do expect(connection).to receive(:execute).with("SET LOCAL lock_timeout TO '15ms'").and_call_original expect(connection).to receive(:execute).with("RELEASE SAVEPOINT active_record_1", "TRANSACTION").and_call_original - subject.run { } + subject.run {} end it 'calls `sleep` after the first iteration fails, using the configured sleep time' do expect(subject).to receive(:run_block_with_lock_timeout).and_raise(ActiveRecord::LockWaitTimeout).twice expect(subject).to receive(:sleep).with(0.025) - subject.run { } + subject.run {} end end @@ -265,13 +265,13 @@ RSpec.describe Gitlab::Database::WithLockRetries do it 'prevents running inside already open transaction' do allow(connection).to receive(:transaction_open?).and_return(true) - expect { subject.run { } }.to raise_error(/should not run inside already open transaction/) + expect { subject.run {} }.to raise_error(/should not run inside already open transaction/) end it 'does not raise the error if not inside open transaction' do allow(connection).to receive(:transaction_open?).and_return(false) - expect { subject.run { } }.not_to raise_error + expect { subject.run {} }.not_to raise_error end end end diff --git a/spec/lib/gitlab/database_importers/common_metrics/importer_spec.rb b/spec/lib/gitlab/database_importers/common_metrics/importer_spec.rb index fdf16069381..1150de880b5 100644 --- a/spec/lib/gitlab/database_importers/common_metrics/importer_spec.rb +++ b/spec/lib/gitlab/database_importers/common_metrics/importer_spec.rb @@ -84,7 +84,7 @@ RSpec.describe Gitlab::DatabaseImporters::CommonMetrics::Importer do end context 'if ID is missing' do - let(:query_identifier) { } + let(:query_identifier) {} it 'raises exception' do expect { subject.execute }.to raise_error(Gitlab::DatabaseImporters::CommonMetrics::Importer::MissingQueryId) diff --git a/spec/lib/gitlab/diff/rendered/notebook/diff_file_helper_spec.rb b/spec/lib/gitlab/diff/rendered/notebook/diff_file_helper_spec.rb index 42ab2d1d063..ad92d90e253 100644 --- a/spec/lib/gitlab/diff/rendered/notebook/diff_file_helper_spec.rb +++ b/spec/lib/gitlab/diff/rendered/notebook/diff_file_helper_spec.rb @@ -49,7 +49,7 @@ RSpec.describe Gitlab::Diff::Rendered::Notebook::DiffFileHelper do describe '#image_as_rich_text' do let(:img) { 'data:image/png;base64,some_image_here' } - let(:line_text) { " ![](#{img})"} + let(:line_text) { " ![](#{img})" } subject { dummy.image_as_rich_text(line_text) } diff --git a/spec/lib/gitlab/email/handler/create_note_handler_spec.rb b/spec/lib/gitlab/email/handler/create_note_handler_spec.rb index 9ff395070ea..585dce331ed 100644 --- a/spec/lib/gitlab/email/handler/create_note_handler_spec.rb +++ b/spec/lib/gitlab/email/handler/create_note_handler_spec.rb @@ -20,7 +20,7 @@ RSpec.describe Gitlab::Email::Handler::CreateNoteHandler do it_behaves_like :note_handler_shared_examples do let(:recipient) { sent_notification.recipient } - let(:update_commands_only) { fixture_file('emails/update_commands_only_reply.eml')} + let(:update_commands_only) { fixture_file('emails/update_commands_only_reply.eml') } let(:no_content) { fixture_file('emails/no_content_reply.eml') } let(:commands_in_reply) { fixture_file('emails/commands_in_reply.eml') } let(:with_quick_actions) { fixture_file('emails/valid_reply_with_quick_actions.eml') } @@ -54,7 +54,7 @@ RSpec.describe Gitlab::Email::Handler::CreateNoteHandler do end context 'with a secondary verified email address' do - let(:verified_email) { 'alan@adventuretime.ooo'} + let(:verified_email) { 'alan@adventuretime.ooo' } let(:email_raw) { fixture_file('emails/valid_reply.eml').gsub('jake@adventuretime.ooo', verified_email) } before do diff --git a/spec/lib/gitlab/email/handler/service_desk_handler_spec.rb b/spec/lib/gitlab/email/handler/service_desk_handler_spec.rb index d0aba70081b..b282e2f9de8 100644 --- a/spec/lib/gitlab/email/handler/service_desk_handler_spec.rb +++ b/spec/lib/gitlab/email/handler/service_desk_handler_spec.rb @@ -532,7 +532,7 @@ RSpec.describe Gitlab::Email::Handler::ServiceDeskHandler do end context 'service desk is disabled for the project' do - let(:group) { create(:group)} + let(:group) { create(:group) } let(:project) { create(:project, :public, group: group, path: 'test', service_desk_enabled: false) } it 'bounces the email' do diff --git a/spec/lib/gitlab/email/message/in_product_marketing/admin_verify_spec.rb b/spec/lib/gitlab/email/message/in_product_marketing/admin_verify_spec.rb index b5c3415fe12..7a09feb5b64 100644 --- a/spec/lib/gitlab/email/message/in_product_marketing/admin_verify_spec.rb +++ b/spec/lib/gitlab/email/message/in_product_marketing/admin_verify_spec.rb @@ -8,7 +8,7 @@ RSpec.describe Gitlab::Email::Message::InProductMarketing::AdminVerify do let(:series) { 0 } - subject(:message) { described_class.new(group: group, user: user, series: series)} + subject(:message) { described_class.new(group: group, user: user, series: series) } describe 'public methods' do it 'returns value for series', :aggregate_failures do diff --git a/spec/lib/gitlab/email/message/in_product_marketing/create_spec.rb b/spec/lib/gitlab/email/message/in_product_marketing/create_spec.rb index 35470ef3555..d5aec280ea6 100644 --- a/spec/lib/gitlab/email/message/in_product_marketing/create_spec.rb +++ b/spec/lib/gitlab/email/message/in_product_marketing/create_spec.rb @@ -8,7 +8,7 @@ RSpec.describe Gitlab::Email::Message::InProductMarketing::Create do let_it_be(:group) { build(:group) } let_it_be(:user) { build(:user) } - subject(:message) { described_class.new(group: group, user: user, series: series)} + subject(:message) { described_class.new(group: group, user: user, series: series) } describe "public methods" do where(series: [0, 1, 2]) diff --git a/spec/lib/gitlab/email/message/in_product_marketing/team_short_spec.rb b/spec/lib/gitlab/email/message/in_product_marketing/team_short_spec.rb index daeacef53f6..3ac2076bf35 100644 --- a/spec/lib/gitlab/email/message/in_product_marketing/team_short_spec.rb +++ b/spec/lib/gitlab/email/message/in_product_marketing/team_short_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Gitlab::Email::Message::InProductMarketing::TeamShort do let(:series) { 0 } - subject(:message) { described_class.new(group: group, user: user, series: series)} + subject(:message) { described_class.new(group: group, user: user, series: series) } describe 'public methods' do it 'returns value for series', :aggregate_failures do diff --git a/spec/lib/gitlab/email/message/in_product_marketing/team_spec.rb b/spec/lib/gitlab/email/message/in_product_marketing/team_spec.rb index eca8ba1df00..3354b2ed5cf 100644 --- a/spec/lib/gitlab/email/message/in_product_marketing/team_spec.rb +++ b/spec/lib/gitlab/email/message/in_product_marketing/team_spec.rb @@ -8,7 +8,7 @@ RSpec.describe Gitlab::Email::Message::InProductMarketing::Team do let_it_be(:group) { build(:group) } let_it_be(:user) { build(:user) } - subject(:message) { described_class.new(group: group, user: user, series: series)} + subject(:message) { described_class.new(group: group, user: user, series: series) } describe "public methods" do where(series: [0, 1]) diff --git a/spec/lib/gitlab/email/message/in_product_marketing/trial_short_spec.rb b/spec/lib/gitlab/email/message/in_product_marketing/trial_short_spec.rb index ebad4672eb3..cf0a119ea80 100644 --- a/spec/lib/gitlab/email/message/in_product_marketing/trial_short_spec.rb +++ b/spec/lib/gitlab/email/message/in_product_marketing/trial_short_spec.rb @@ -8,7 +8,7 @@ RSpec.describe Gitlab::Email::Message::InProductMarketing::TrialShort do let(:series) { 0 } - subject(:message) { described_class.new(group: group, user: user, series: series)} + subject(:message) { described_class.new(group: group, user: user, series: series) } describe 'public methods' do it 'returns value for series', :aggregate_failures do diff --git a/spec/lib/gitlab/email/message/in_product_marketing/trial_spec.rb b/spec/lib/gitlab/email/message/in_product_marketing/trial_spec.rb index 3e18b8e35b6..7f86c9a6c6f 100644 --- a/spec/lib/gitlab/email/message/in_product_marketing/trial_spec.rb +++ b/spec/lib/gitlab/email/message/in_product_marketing/trial_spec.rb @@ -8,7 +8,7 @@ RSpec.describe Gitlab::Email::Message::InProductMarketing::Trial do let_it_be(:group) { build(:group) } let_it_be(:user) { build(:user) } - subject(:message) { described_class.new(group: group, user: user, series: series)} + subject(:message) { described_class.new(group: group, user: user, series: series) } describe "public methods" do where(series: [0, 1, 2]) diff --git a/spec/lib/gitlab/email/message/in_product_marketing/verify_spec.rb b/spec/lib/gitlab/email/message/in_product_marketing/verify_spec.rb index a7da2e9553d..7e6f62289d2 100644 --- a/spec/lib/gitlab/email/message/in_product_marketing/verify_spec.rb +++ b/spec/lib/gitlab/email/message/in_product_marketing/verify_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Gitlab::Email::Message::InProductMarketing::Verify do let_it_be(:group) { build(:group) } let_it_be(:user) { build(:user) } - subject(:message) { described_class.new(group: group, user: user, series: series)} + subject(:message) { described_class.new(group: group, user: user, series: series) } describe "public methods" do context 'with series 0' do diff --git a/spec/lib/gitlab/error_tracking/logger_spec.rb b/spec/lib/gitlab/error_tracking/logger_spec.rb index 751ec10a1f0..1b722fc7896 100644 --- a/spec/lib/gitlab/error_tracking/logger_spec.rb +++ b/spec/lib/gitlab/error_tracking/logger_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Gitlab::ErrorTracking::Logger do describe '.capture_exception' do let(:exception) { RuntimeError.new('boom') } let(:payload) { { foo: '123' } } - let(:log_entry) { { message: 'boom', context: payload }} + let(:log_entry) { { message: 'boom', context: payload } } it 'calls Gitlab::ErrorTracking::Logger.error with formatted log entry' do expect_next_instance_of(Gitlab::ErrorTracking::LogFormatter) do |log_formatter| diff --git a/spec/lib/gitlab/error_tracking/processor/sidekiq_processor_spec.rb b/spec/lib/gitlab/error_tracking/processor/sidekiq_processor_spec.rb index d33f8393904..bc4526758c0 100644 --- a/spec/lib/gitlab/error_tracking/processor/sidekiq_processor_spec.rb +++ b/spec/lib/gitlab/error_tracking/processor/sidekiq_processor_spec.rb @@ -159,13 +159,13 @@ RSpec.describe Gitlab::ErrorTracking::Processor::SidekiqProcessor, :sentry do context 'when processing via the default error handler' do context 'with Raven events' do - let(:event) { raven_event} + let(:event) { raven_event } include_examples 'Sidekiq arguments', args_in_job_hash: true end context 'with Sentry events' do - let(:event) { sentry_event} + let(:event) { sentry_event } include_examples 'Sidekiq arguments', args_in_job_hash: true end @@ -173,13 +173,13 @@ RSpec.describe Gitlab::ErrorTracking::Processor::SidekiqProcessor, :sentry do context 'when processing via Gitlab::ErrorTracking' do context 'with Raven events' do - let(:event) { raven_event} + let(:event) { raven_event } include_examples 'Sidekiq arguments', args_in_job_hash: false end context 'with Sentry events' do - let(:event) { sentry_event} + let(:event) { sentry_event } include_examples 'Sidekiq arguments', args_in_job_hash: false end @@ -209,13 +209,13 @@ RSpec.describe Gitlab::ErrorTracking::Processor::SidekiqProcessor, :sentry do end context 'with Raven events' do - let(:event) { raven_event} + let(:event) { raven_event } it_behaves_like 'handles jobstr fields' end context 'with Sentry events' do - let(:event) { sentry_event} + let(:event) { sentry_event } it_behaves_like 'handles jobstr fields' end @@ -233,13 +233,13 @@ RSpec.describe Gitlab::ErrorTracking::Processor::SidekiqProcessor, :sentry do end context 'with Raven events' do - let(:event) { raven_event} + let(:event) { raven_event } it_behaves_like 'does nothing' end context 'with Sentry events' do - let(:event) { sentry_event} + let(:event) { sentry_event } it_behaves_like 'does nothing' end @@ -256,13 +256,13 @@ RSpec.describe Gitlab::ErrorTracking::Processor::SidekiqProcessor, :sentry do end context 'with Raven events' do - let(:event) { raven_event} + let(:event) { raven_event } it_behaves_like 'does nothing' end context 'with Sentry events' do - let(:event) { sentry_event} + let(:event) { sentry_event } it_behaves_like 'does nothing' end diff --git a/spec/lib/gitlab/exclusive_lease_helpers_spec.rb b/spec/lib/gitlab/exclusive_lease_helpers_spec.rb index 8bf06bcebe2..f9db93a6167 100644 --- a/spec/lib/gitlab/exclusive_lease_helpers_spec.rb +++ b/spec/lib/gitlab/exclusive_lease_helpers_spec.rb @@ -9,12 +9,12 @@ RSpec.describe Gitlab::ExclusiveLeaseHelpers, :clean_gitlab_redis_shared_state d let(:unique_key) { SecureRandom.hex(10) } describe '#in_lock' do - subject { class_instance.in_lock(unique_key, **options) { } } + subject { class_instance.in_lock(unique_key, **options) {} } let(:options) { {} } context 'when unique key is not set' do - let(:unique_key) { } + let(:unique_key) {} it 'raises an error' do expect { subject }.to raise_error ArgumentError diff --git a/spec/lib/gitlab/file_markdown_link_builder_spec.rb b/spec/lib/gitlab/file_markdown_link_builder_spec.rb index ea21bda12d3..d684beaaaca 100644 --- a/spec/lib/gitlab/file_markdown_link_builder_spec.rb +++ b/spec/lib/gitlab/file_markdown_link_builder_spec.rb @@ -13,7 +13,7 @@ RSpec.describe Gitlab::FileMarkdownLinkBuilder do end describe 'markdown_link' do - let(:url) { "/uploads/#{filename}"} + let(:url) { "/uploads/#{filename}" } before do allow(custom_class).to receive(:secure_url).and_return(url) diff --git a/spec/lib/gitlab/git/blame_spec.rb b/spec/lib/gitlab/git/blame_spec.rb index e514e128785..45d88f57c09 100644 --- a/spec/lib/gitlab/git/blame_spec.rb +++ b/spec/lib/gitlab/git/blame_spec.rb @@ -32,7 +32,7 @@ RSpec.describe Gitlab::Git::Blame do it 'only returns the range' do expect(result.size).to eq(range.size) - expect(result.map {|r| r[:line] }).to eq(['', 'This guide details how contribute to GitLab.', '']) + expect(result.map { |r| r[:line] }).to eq(['', 'This guide details how contribute to GitLab.', '']) end end diff --git a/spec/lib/gitlab/git/blob_spec.rb b/spec/lib/gitlab/git/blob_spec.rb index fb4510a78de..eb9a9c294c9 100644 --- a/spec/lib/gitlab/git/blob_spec.rb +++ b/spec/lib/gitlab/git/blob_spec.rb @@ -50,7 +50,7 @@ RSpec.describe Gitlab::Git::Blob, :seed_helper do end context 'utf-8 branch' do - let(:blob) { Gitlab::Git::Blob.find(repository, 'Ääh-test-utf-8', "files/ruby/popen.rb")} + let(:blob) { Gitlab::Git::Blob.find(repository, 'Ääh-test-utf-8', "files/ruby/popen.rb") } it { expect(blob.id).to eq(SeedRepo::RubyBlob::ID) } end diff --git a/spec/lib/gitlab/git/commit_spec.rb b/spec/lib/gitlab/git/commit_spec.rb index da77d8ee5d6..d12e876d60e 100644 --- a/spec/lib/gitlab/git/commit_spec.rb +++ b/spec/lib/gitlab/git/commit_spec.rb @@ -570,13 +570,13 @@ RSpec.describe Gitlab::Git::Commit, :seed_helper do describe '#id' do subject { super().id } - it { is_expected.to eq(sample_commit_hash[:id])} + it { is_expected.to eq(sample_commit_hash[:id]) } end describe '#message' do subject { super().message } - it { is_expected.to eq(sample_commit_hash[:message])} + it { is_expected.to eq(sample_commit_hash[:message]) } end end diff --git a/spec/lib/gitlab/git/diff_collection_spec.rb b/spec/lib/gitlab/git/diff_collection_spec.rb index 114b3d01952..0e3e92e03cf 100644 --- a/spec/lib/gitlab/git/diff_collection_spec.rb +++ b/spec/lib/gitlab/git/diff_collection_spec.rb @@ -520,7 +520,7 @@ RSpec.describe Gitlab::Git::DiffCollection, :seed_helper do describe '#real_size' do subject { super().real_size } - it { is_expected.to eq('0')} + it { is_expected.to eq('0') } end describe '#line_count' do @@ -595,7 +595,7 @@ RSpec.describe Gitlab::Git::DiffCollection, :seed_helper do end context 'multi-file collections' do - let(:iterator) { [{ diff: 'b' }, { diff: 'a' * 20480 }]} + let(:iterator) { [{ diff: 'b' }, { diff: 'a' * 20480 }] } it 'prunes diffs that are quite big' do diff = nil diff --git a/spec/lib/gitlab/git/raw_diff_change_spec.rb b/spec/lib/gitlab/git/raw_diff_change_spec.rb index f894ae1d98b..c55fcc729b6 100644 --- a/spec/lib/gitlab/git/raw_diff_change_spec.rb +++ b/spec/lib/gitlab/git/raw_diff_change_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe Gitlab::Git::RawDiffChange do - let(:raw_change) { } + let(:raw_change) {} let(:change) { described_class.new(raw_change) } context 'bad input' do diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb index 0b5c066430d..1a18d81cd2a 100644 --- a/spec/lib/gitlab/git/repository_spec.rb +++ b/spec/lib/gitlab/git/repository_spec.rb @@ -1252,8 +1252,8 @@ RSpec.describe Gitlab::Git::Repository, :seed_helper do end describe '#raw_changes_between' do - let(:old_rev) { } - let(:new_rev) { } + let(:old_rev) {} + let(:new_rev) {} let(:changes) { repository.raw_changes_between(old_rev, new_rev) } context 'initial commit' do @@ -2474,7 +2474,7 @@ RSpec.describe Gitlab::Git::Repository, :seed_helper do end describe '#rename' do - let(:project) { create(:project, :repository)} + let(:project) { create(:project, :repository) } let(:repository) { project.repository } it 'moves the repository' do diff --git a/spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb b/spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb index b2603e099e6..592d5b148f5 100644 --- a/spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb +++ b/spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb @@ -165,7 +165,7 @@ RSpec.describe Gitlab::Git::RuggedImpl::UseRugged, :seed_helper do context 'all features are enabled' do let(:feature_keys) { [:feature_key_1, :feature_key_2] } - it { is_expected.to be_truthy} + it { is_expected.to be_truthy } end context 'all features are not enabled' do diff --git a/spec/lib/gitlab/gitaly_client/commit_service_spec.rb b/spec/lib/gitlab/gitaly_client/commit_service_spec.rb index d5d1bef7bff..0d591fe6c43 100644 --- a/spec/lib/gitlab/gitaly_client/commit_service_spec.rb +++ b/spec/lib/gitlab/gitaly_client/commit_service_spec.rb @@ -340,7 +340,7 @@ RSpec.describe Gitlab::GitalyClient::CommitService do describe '#list_new_commits' do let(:revisions) { [revision] } let(:gitaly_commits) { create_list(:gitaly_commit, 3) } - let(:expected_commits) { gitaly_commits.map { |c| Gitlab::Git::Commit.new(repository, c) }} + let(:expected_commits) { gitaly_commits.map { |c| Gitlab::Git::Commit.new(repository, c) } } subject do client.list_new_commits(revisions) diff --git a/spec/lib/gitlab/gitaly_client/operation_service_spec.rb b/spec/lib/gitlab/gitaly_client/operation_service_spec.rb index e04895d975f..5d854f0c9d1 100644 --- a/spec/lib/gitlab/gitaly_client/operation_service_spec.rb +++ b/spec/lib/gitlab/gitaly_client/operation_service_spec.rb @@ -84,37 +84,6 @@ RSpec.describe Gitlab::GitalyClient::OperationService do subject end - describe '#user_merge_to_ref' do - let(:first_parent_ref) { 'refs/heads/my-branch' } - let(:source_sha) { 'cfe32cf61b73a0d5e9f13e774abde7ff789b1660' } - let(:ref) { 'refs/merge-requests/x/merge' } - let(:message) { 'validación' } - let(:response) { Gitaly::UserMergeToRefResponse.new(commit_id: 'new-commit-id') } - - let(:payload) do - { source_sha: source_sha, branch: 'branch', target_ref: ref, - message: message, first_parent_ref: first_parent_ref, allow_conflicts: true } - end - - it 'sends a user_merge_to_ref message' do - freeze_time do - expect_any_instance_of(Gitaly::OperationService::Stub).to receive(:user_merge_to_ref) do |_, request, options| - expect(options).to be_kind_of(Hash) - expect(request.to_h).to eq( - payload.merge({ - repository: repository.gitaly_repository.to_h, - message: message.dup.force_encoding(Encoding::ASCII_8BIT), - user: Gitlab::Git::User.from_gitlab(user).to_gitaly.to_h, - timestamp: { nanos: 0, seconds: Time.current.to_i } - }) - ) - end.and_return(response) - - client.user_merge_to_ref(user, **payload) - end - end - end - context "when pre_receive_error is present" do let(:response) do Gitaly::UserUpdateBranchResponse.new(pre_receive_error: "GitLab: something failed") @@ -131,6 +100,37 @@ RSpec.describe Gitlab::GitalyClient::OperationService do end end + describe '#user_merge_to_ref' do + let(:first_parent_ref) { 'refs/heads/my-branch' } + let(:source_sha) { 'cfe32cf61b73a0d5e9f13e774abde7ff789b1660' } + let(:ref) { 'refs/merge-requests/x/merge' } + let(:message) { 'validación' } + let(:response) { Gitaly::UserMergeToRefResponse.new(commit_id: 'new-commit-id') } + + let(:payload) do + { source_sha: source_sha, branch: 'branch', target_ref: ref, + message: message, first_parent_ref: first_parent_ref, allow_conflicts: true } + end + + it 'sends a user_merge_to_ref message' do + freeze_time do + expect_any_instance_of(Gitaly::OperationService::Stub).to receive(:user_merge_to_ref) do |_, request, options| + expect(options).to be_kind_of(Hash) + expect(request.to_h).to eq( + payload.merge({ + repository: repository.gitaly_repository.to_h, + message: message.dup.force_encoding(Encoding::ASCII_8BIT), + user: Gitlab::Git::User.from_gitlab(user).to_gitaly.to_h, + timestamp: { nanos: 0, seconds: Time.current.to_i } + }) + ) + end.and_return(response) + + client.user_merge_to_ref(user, **payload) + end + end + end + describe '#user_delete_branch' do let(:branch_name) { 'my-branch' } let(:request) do @@ -551,7 +551,7 @@ RSpec.describe Gitlab::GitalyClient::OperationService do end let(:expected_error) { Gitlab::Git::Repository::CreateTreeError } - let(:expected_error_message) { } + let(:expected_error_message) {} it_behaves_like '#user_cherry_pick with a gRPC error' end @@ -559,7 +559,7 @@ RSpec.describe Gitlab::GitalyClient::OperationService do context 'when a non-detailed gRPC error is raised' do let(:raised_error) { GRPC::Internal.new('non-detailed error') } let(:expected_error) { GRPC::Internal } - let(:expected_error_message) { } + let(:expected_error_message) {} it_behaves_like '#user_cherry_pick with a gRPC error' end @@ -813,4 +813,146 @@ RSpec.describe Gitlab::GitalyClient::OperationService do end end end + + describe '#add_tag' do + let(:tag_name) { 'some-tag' } + let(:tag_message) { nil } + let(:target) { 'master' } + + subject(:add_tag) do + client.add_tag(tag_name, user, target, tag_message) + end + + context 'without tag message' do + let(:tag_name) { 'lightweight-tag' } + + it 'creates a lightweight tag' do + tag = add_tag + expect(tag.name).to eq(tag_name) + expect(tag.message).to eq('') + end + end + + context 'with tag message' do + let(:tag_name) { 'annotated-tag' } + let(:tag_message) { "tag message" } + + it 'creates an annotated tag' do + tag = add_tag + expect(tag.name).to eq(tag_name) + expect(tag.message).to eq(tag_message) + end + end + + context 'with preexisting tag' do + let(:tag_name) { 'v1.0.0' } + + it 'raises a TagExistsError' do + expect { add_tag }.to raise_error(Gitlab::Git::Repository::TagExistsError) + end + end + + context 'with invalid target' do + let(:target) { 'refs/heads/does-not-exist' } + + it 'raises an InvalidRef error' do + expect { add_tag }.to raise_error(Gitlab::Git::Repository::InvalidRef) + end + end + + context 'with pre-receive error' do + before do + expect_any_instance_of(Gitaly::OperationService::Stub) + .to receive(:user_create_tag) + .and_return(Gitaly::UserCreateTagResponse.new(pre_receive_error: "GitLab: something failed")) + end + + it 'raises a PreReceiveError' do + expect { add_tag }.to raise_error(Gitlab::Git::PreReceiveError, "something failed") + end + end + + context 'with internal error' do + before do + expect_any_instance_of(Gitaly::OperationService::Stub) + .to receive(:user_create_tag) + .and_raise(GRPC::Internal.new('undetailed internal error')) + end + + it 'raises an Internal error' do + expect { add_tag }.to raise_error do |error| + expect(error).to be_a(GRPC::Internal) + expect(error.details).to eq('undetailed internal error') + end + end + end + + context 'with structured errors' do + before do + expect_any_instance_of(Gitaly::OperationService::Stub) + .to receive(:user_create_tag) + .and_raise(structured_error) + end + + context 'with ReferenceExistsError' do + let(:structured_error) do + new_detailed_error( + GRPC::Core::StatusCodes::ALREADY_EXISTS, + 'tag exists already', + Gitaly::UserCreateTagError.new( + reference_exists: Gitaly::ReferenceExistsError.new( + reference_name: tag_name, + oid: 'something' + ))) + end + + it 'raises a TagExistsError' do + expect { add_tag }.to raise_error(Gitlab::Git::Repository::TagExistsError) + end + end + + context 'with AccessCheckError' do + let(:structured_error) do + new_detailed_error( + GRPC::Core::StatusCodes::PERMISSION_DENIED, + "error creating tag", + Gitaly::UserCreateTagError.new( + access_check: Gitaly::AccessCheckError.new( + error_message: "You are not allowed to create this tag.", + protocol: "web", + user_id: "user-15", + changes: "df15b32277d2c55c6c595845a87109b09c913c556 5d6e0f935ad9240655f64e883cd98fad6f9a17ee refs/tags/v1.0.0\n" + ))) + end + + it 'raises a PreReceiveError' do + expect { add_tag }.to raise_error do |error| + expect(error).to be_a(Gitlab::Git::PreReceiveError) + expect(error.message).to eq("You are not allowed to create this tag.") + end + end + end + + context 'with CustomHookError' do + let(:structured_error) do + new_detailed_error( + GRPC::Core::StatusCodes::PERMISSION_DENIED, + "custom hook error", + Gitaly::UserCreateTagError.new( + custom_hook: Gitaly::CustomHookError.new( + stdout: "some stdout", + stderr: "GitLab: some custom hook error message", + hook_type: Gitaly::CustomHookError::HookType::HOOK_TYPE_PRERECEIVE + ))) + end + + it 'raises a PreReceiveError' do + expect { add_tag }.to raise_error do |error| + expect(error).to be_a(Gitlab::Git::PreReceiveError) + expect(error.message).to eq("some custom hook error message") + end + end + end + end + end end diff --git a/spec/lib/gitlab/gitaly_client/ref_service_spec.rb b/spec/lib/gitlab/gitaly_client/ref_service_spec.rb index 566bdbacf4a..358f09c972c 100644 --- a/spec/lib/gitlab/gitaly_client/ref_service_spec.rb +++ b/spec/lib/gitlab/gitaly_client/ref_service_spec.rb @@ -286,7 +286,7 @@ RSpec.describe Gitlab::GitalyClient::RefService do end context 'with a invalid format error' do - let(:invalid_refs) {['\invali.\d/1', '\.invali/d/2']} + let(:invalid_refs) { ['\invali.\d/1', '\.invali/d/2'] } let(:invalid_reference_format_error) do new_detailed_error( GRPC::Core::StatusCodes::INVALID_ARGUMENT, diff --git a/spec/lib/gitlab/github_import/client_spec.rb b/spec/lib/gitlab/github_import/client_spec.rb index c4d05e92633..2bd3910ad87 100644 --- a/spec/lib/gitlab/github_import/client_spec.rb +++ b/spec/lib/gitlab/github_import/client_spec.rb @@ -208,7 +208,7 @@ RSpec.describe Gitlab::GithubImport::Client do expect(client).to receive(:requests_remaining?).and_return(true) - client.with_rate_limit { } + client.with_rate_limit {} end it 'ignores rate limiting when disabled' do diff --git a/spec/lib/gitlab/github_import/importer/pull_requests_importer_spec.rb b/spec/lib/gitlab/github_import/importer/pull_requests_importer_spec.rb index c1b0f4df29a..c5846fa7a87 100644 --- a/spec/lib/gitlab/github_import/importer/pull_requests_importer_spec.rb +++ b/spec/lib/gitlab/github_import/importer/pull_requests_importer_spec.rb @@ -149,7 +149,7 @@ RSpec.describe Gitlab::GithubImport::Importer::PullRequestsImporter do expect(importer) .to receive(:update_repository) - importer.each_object_to_import { } + importer.each_object_to_import {} end end diff --git a/spec/lib/gitlab/gpg_spec.rb b/spec/lib/gitlab/gpg_spec.rb index 72c6c8efb5e..e64555f1079 100644 --- a/spec/lib/gitlab/gpg_spec.rb +++ b/spec/lib/gitlab/gpg_spec.rb @@ -218,7 +218,7 @@ RSpec.describe Gitlab::Gpg do expect(Retriable).to receive(:sleep).at_least(:twice) expect(FileUtils).to receive(:remove_entry).with(tmp_dir).at_least(:twice).and_raise('Deletion failed') - expect { described_class.using_tmp_keychain { } }.to raise_error(described_class::CleanupError) + expect { described_class.using_tmp_keychain {} }.to raise_error(described_class::CleanupError) end it 'does not attempt multiple times when the deletion succeeds' do @@ -226,7 +226,7 @@ RSpec.describe Gitlab::Gpg do expect(FileUtils).to receive(:remove_entry).with(tmp_dir).once.and_raise('Deletion failed') expect(FileUtils).to receive(:remove_entry).with(tmp_dir).and_call_original - expect { described_class.using_tmp_keychain { } }.not_to raise_error + expect { described_class.using_tmp_keychain {} }.not_to raise_error expect(File.exist?(tmp_dir)).to be false end diff --git a/spec/lib/gitlab/graphql/deprecation_spec.rb b/spec/lib/gitlab/graphql/deprecation_spec.rb index 0ff4c232c6f..c9b47219198 100644 --- a/spec/lib/gitlab/graphql/deprecation_spec.rb +++ b/spec/lib/gitlab/graphql/deprecation_spec.rb @@ -237,4 +237,20 @@ RSpec.describe ::Gitlab::Graphql::Deprecation do end end end + + describe '#alpha?' do + let(:options) { { milestone: '10.10', reason: reason } } + + context 'when `reason` is `:alpha`' do + let(:reason) { described_class::REASON_ALPHA } + + it { is_expected.to be_alpha } + end + + context 'when `reason` is not `:alpha`' do + let(:reason) { described_class::REASON_RENAMED } + + it { is_expected.not_to be_alpha } + end + end end diff --git a/spec/lib/gitlab/graphs/commits_spec.rb b/spec/lib/gitlab/graphs/commits_spec.rb index 79cec2d8705..c3c696ceedc 100644 --- a/spec/lib/gitlab/graphs/commits_spec.rb +++ b/spec/lib/gitlab/graphs/commits_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Gitlab::Graphs::Commits do let!(:project) { create(:project, :public) } let!(:commit1) { create(:commit, git_commit: RepoHelpers.sample_commit, project: project, committed_date: Time.now) } - let!(:commit1_yesterday) { create(:commit, git_commit: RepoHelpers.sample_commit, project: project, committed_date: 1.day.ago)} + let!(:commit1_yesterday) { create(:commit, git_commit: RepoHelpers.sample_commit, project: project, committed_date: 1.day.ago) } let!(:commit2) { create(:commit, git_commit: RepoHelpers.another_sample_commit, project: project, committed_date: Time.now) } diff --git a/spec/lib/gitlab/highlight_spec.rb b/spec/lib/gitlab/highlight_spec.rb index 537e59d91c3..d7ae6ed06a4 100644 --- a/spec/lib/gitlab/highlight_spec.rb +++ b/spec/lib/gitlab/highlight_spec.rb @@ -71,7 +71,7 @@ RSpec.describe Gitlab::Highlight do context 'diff highlighting' do let(:file_name) { 'test.diff' } - let(:content) { "+aaa\n+bbb\n- ccc\n ddd\n"} + let(:content) { "+aaa\n+bbb\n- ccc\n ddd\n" } let(:expected) do %q(<span id="LC1" class="line" lang="diff"><span class="gi">+aaa</span></span> <span id="LC2" class="line" lang="diff"><span class="gi">+bbb</span></span> diff --git a/spec/lib/gitlab/import_export/import_test_coverage_spec.rb b/spec/lib/gitlab/import_export/import_test_coverage_spec.rb index 90966cb4915..51c0008b2b4 100644 --- a/spec/lib/gitlab/import_export/import_test_coverage_spec.rb +++ b/spec/lib/gitlab/import_export/import_test_coverage_spec.rb @@ -88,8 +88,8 @@ RSpec.describe 'Test coverage of the Project Import' do def relations_from_json(json_file) json = Gitlab::Json.parse(IO.read(json_file)) - [].tap {|res| gather_relations({ project: json }, res, [])} - .map {|relation_names| relation_names.join('.')} + [].tap { |res| gather_relations({ project: json }, res, []) } + .map { |relation_names| relation_names.join('.') } end def gather_relations(item, res, path) @@ -103,7 +103,7 @@ RSpec.describe 'Test coverage of the Project Import' do end end when Array - item.each {|i| gather_relations(i, res, path)} + item.each { |i| gather_relations(i, res, path) } end end diff --git a/spec/lib/gitlab/import_export/json/ndjson_writer_spec.rb b/spec/lib/gitlab/import_export/json/ndjson_writer_spec.rb index 9be95591ae9..452d63d548e 100644 --- a/spec/lib/gitlab/import_export/json/ndjson_writer_spec.rb +++ b/spec/lib/gitlab/import_export/json/ndjson_writer_spec.rb @@ -41,7 +41,7 @@ RSpec.describe Gitlab::ImportExport::Json::NdjsonWriter do file_path = File.join(path, exportable_path, "#{relation}.ndjson") subject.write_relation(exportable_path, relation, values[0]) - expect {subject.write_relation(exportable_path, relation, values[1])}.to raise_exception("The #{file_path} already exist") + expect { subject.write_relation(exportable_path, relation, values[1]) }.to raise_exception("The #{file_path} already exist") end end end diff --git a/spec/lib/gitlab/import_export/project/tree_restorer_spec.rb b/spec/lib/gitlab/import_export/project/tree_restorer_spec.rb index 157cd408da9..5ede3597643 100644 --- a/spec/lib/gitlab/import_export/project/tree_restorer_spec.rb +++ b/spec/lib/gitlab/import_export/project/tree_restorer_spec.rb @@ -589,7 +589,7 @@ RSpec.describe Gitlab::ImportExport::Project::TreeRestorer do it 'issue system note metadata restored successfully' do note_content = 'created merge request !1 to address this issue' - note = project.issues.first.notes.find { |n| n.note.match(/#{note_content}/)} + note = project.issues.first.notes.find { |n| n.note.match(/#{note_content}/) } expect(note.noteable_type).to eq('Issue') expect(note.system).to eq(true) diff --git a/spec/lib/gitlab/import_export/version_checker_spec.rb b/spec/lib/gitlab/import_export/version_checker_spec.rb index 9e69e04b17c..14c62edb786 100644 --- a/spec/lib/gitlab/import_export/version_checker_spec.rb +++ b/spec/lib/gitlab/import_export/version_checker_spec.rb @@ -30,7 +30,7 @@ RSpec.describe Gitlab::ImportExport::VersionChecker do end context 'newer version' do - let(:version) { '900.0'} + let(:version) { '900.0' } it 'returns false if export version is newer' do expect(described_class.check!(shared: shared)).to be false diff --git a/spec/lib/gitlab/jira/dvcs_spec.rb b/spec/lib/gitlab/jira/dvcs_spec.rb index 09e777b38ea..76d81343875 100644 --- a/spec/lib/gitlab/jira/dvcs_spec.rb +++ b/spec/lib/gitlab/jira/dvcs_spec.rb @@ -24,8 +24,8 @@ RSpec.describe Gitlab::Jira::Dvcs do end describe '.encode_project_name' do - let(:group) { create(:group)} - let(:project) { create(:project, group: group)} + let(:group) { create(:group) } + let(:project) { create(:project, group: group) } context 'root group' do it 'returns project path' do @@ -34,7 +34,7 @@ RSpec.describe Gitlab::Jira::Dvcs do end context 'nested group' do - let(:group) { create(:group, :nested)} + let(:group) { create(:group, :nested) } it 'returns encoded project full path' do expect(described_class.encode_project_name(project)).to eq(described_class.encode_slash(project.full_path)) diff --git a/spec/lib/gitlab/kubernetes/rollout_status_spec.rb b/spec/lib/gitlab/kubernetes/rollout_status_spec.rb index 8ed9fdd799c..21d345f0739 100644 --- a/spec/lib/gitlab/kubernetes/rollout_status_spec.rb +++ b/spec/lib/gitlab/kubernetes/rollout_status_spec.rb @@ -213,7 +213,7 @@ RSpec.describe Gitlab::Kubernetes::RolloutStatus do let(:specs) { specs_half_finished } - it { is_expected.to be_falsy} + it { is_expected.to be_falsy } end end diff --git a/spec/lib/gitlab/memory/reports/jemalloc_stats_spec.rb b/spec/lib/gitlab/memory/reports/jemalloc_stats_spec.rb index 56eeceea174..1b056b87bf9 100644 --- a/spec/lib/gitlab/memory/reports/jemalloc_stats_spec.rb +++ b/spec/lib/gitlab/memory/reports/jemalloc_stats_spec.rb @@ -7,14 +7,14 @@ RSpec.describe Gitlab::Memory::Reports::JemallocStats do describe '.run' do context 'when :report_jemalloc_stats ops FF is enabled' do - let(:worker_id) {'puma_1'} + let(:worker_id) { 'puma_1' } before do allow(Prometheus::PidProvider).to receive(:worker_id).and_return(worker_id) end context 'when GITLAB_DIAGNOSTIC_REPORTS_PATH env var is set' do - let(:reports_dir) {'/empty-dir'} + let(:reports_dir) { '/empty-dir' } before do stub_env('GITLAB_DIAGNOSTIC_REPORTS_PATH', reports_dir) @@ -73,7 +73,7 @@ RSpec.describe Gitlab::Memory::Reports::JemallocStats do .from(5).to(3) # Keeps only the newest reports - expect(reports.last(3).all? {|r| File.exist?(r) }).to be true + expect(reports.last(3).all? { |r| File.exist?(r) }).to be true end end diff --git a/spec/lib/gitlab/metrics/background_transaction_spec.rb b/spec/lib/gitlab/metrics/background_transaction_spec.rb index 83bee84df99..2e48070cb4f 100644 --- a/spec/lib/gitlab/metrics/background_transaction_spec.rb +++ b/spec/lib/gitlab/metrics/background_transaction_spec.rb @@ -23,7 +23,7 @@ RSpec.describe Gitlab::Metrics::BackgroundTransaction do end it 'removes the transaction from the current thread upon completion' do - transaction.run { } + transaction.run {} expect(Thread.current[described_class::THREAD_KEY]).to be_nil end diff --git a/spec/lib/gitlab/metrics/web_transaction_spec.rb b/spec/lib/gitlab/metrics/web_transaction_spec.rb index 06ce58a9e84..d6590efcf4f 100644 --- a/spec/lib/gitlab/metrics/web_transaction_spec.rb +++ b/spec/lib/gitlab/metrics/web_transaction_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Gitlab::Metrics::WebTransaction do end it 'removes the transaction from the current thread upon completion' do - transaction.run { } + transaction.run {} expect(Thread.current[described_class::THREAD_KEY]).to be_nil expect(described_class.current).to be_nil diff --git a/spec/lib/gitlab/middleware/compressed_json_spec.rb b/spec/lib/gitlab/middleware/compressed_json_spec.rb index a07cd49c572..6d49ab58d5d 100644 --- a/spec/lib/gitlab/middleware/compressed_json_spec.rb +++ b/spec/lib/gitlab/middleware/compressed_json_spec.rb @@ -33,7 +33,7 @@ RSpec.describe Gitlab::Middleware::CompressedJson do describe '#call' do context 'with collector route' do - let(:path) { '/api/v4/error_tracking/collector/1/store'} + let(:path) { '/api/v4/error_tracking/collector/1/store' } it_behaves_like 'decompress middleware' @@ -45,7 +45,7 @@ RSpec.describe Gitlab::Middleware::CompressedJson do end context 'with collector route under relative url' do - let(:path) { '/gitlab/api/v4/error_tracking/collector/1/store'} + let(:path) { '/gitlab/api/v4/error_tracking/collector/1/store' } before do stub_config_setting(relative_url_root: '/gitlab') @@ -71,7 +71,7 @@ RSpec.describe Gitlab::Middleware::CompressedJson do let(:body_limit) { Gitlab::Middleware::CompressedJson::MAXIMUM_BODY_SIZE } let(:decompressed_input) { 'a' * (body_limit + 100) } let(:input) { ActiveSupport::Gzip.compress(decompressed_input) } - let(:path) { '/api/v4/error_tracking/collector/1/envelope'} + let(:path) { '/api/v4/error_tracking/collector/1/envelope' } it 'reads only limited size' do expect(middleware.call(env)) diff --git a/spec/lib/gitlab/middleware/sidekiq_web_static_spec.rb b/spec/lib/gitlab/middleware/sidekiq_web_static_spec.rb index e6815a46a56..91c030a0f45 100644 --- a/spec/lib/gitlab/middleware/sidekiq_web_static_spec.rb +++ b/spec/lib/gitlab/middleware/sidekiq_web_static_spec.rb @@ -14,7 +14,7 @@ RSpec.describe Gitlab::Middleware::SidekiqWebStatic do end context 'with an /admin/sidekiq route' do - let(:path) { '/admin/sidekiq/javascripts/application.js'} + let(:path) { '/admin/sidekiq/javascripts/application.js' } it 'deletes the HTTP_X_SENDFILE_TYPE header' do expect(app).to receive(:call) diff --git a/spec/lib/gitlab/otp_key_rotator_spec.rb b/spec/lib/gitlab/otp_key_rotator_spec.rb index e328b190db4..e3b9f006b19 100644 --- a/spec/lib/gitlab/otp_key_rotator_spec.rb +++ b/spec/lib/gitlab/otp_key_rotator_spec.rb @@ -42,7 +42,7 @@ RSpec.describe Gitlab::OtpKeyRotator do it 'stores the calculated values in a spreadsheet' do rotation - expect(data).to match_array(users.map {|u| build_row(u) }) + expect(data).to match_array(users.map { |u| build_row(u) }) end context 'new key is too short' do diff --git a/spec/lib/gitlab/pagination/keyset_spec.rb b/spec/lib/gitlab/pagination/keyset_spec.rb index 81dc40b35d5..8885e684d8a 100644 --- a/spec/lib/gitlab/pagination/keyset_spec.rb +++ b/spec/lib/gitlab/pagination/keyset_spec.rb @@ -18,7 +18,7 @@ RSpec.describe Gitlab::Pagination::Keyset do describe '.available?' do subject { described_class } - let(:request_context) { double("request context", page: page)} + let(:request_context) { double("request context", page: page) } let(:page) { double("page", order_by: order_by) } shared_examples_for 'keyset pagination is available' do diff --git a/spec/lib/gitlab/phabricator_import/conduit/response_spec.rb b/spec/lib/gitlab/phabricator_import/conduit/response_spec.rb index c368b349a3c..a444e7fdf47 100644 --- a/spec/lib/gitlab/phabricator_import/conduit/response_spec.rb +++ b/spec/lib/gitlab/phabricator_import/conduit/response_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' RSpec.describe Gitlab::PhabricatorImport::Conduit::Response do - let(:response) { described_class.new(Gitlab::Json.parse(fixture_file('phabricator_responses/maniphest.search.json')))} + let(:response) { described_class.new(Gitlab::Json.parse(fixture_file('phabricator_responses/maniphest.search.json'))) } let(:error_response) { described_class.new(Gitlab::Json.parse(fixture_file('phabricator_responses/auth_failed.json'))) } describe '.parse!' do diff --git a/spec/lib/gitlab/prometheus_client_spec.rb b/spec/lib/gitlab/prometheus_client_spec.rb index 89ddde4a01d..9083c5625d4 100644 --- a/spec/lib/gitlab/prometheus_client_spec.rb +++ b/spec/lib/gitlab/prometheus_client_spec.rb @@ -104,7 +104,7 @@ RSpec.describe Gitlab::PrometheusClient do end describe 'failure to reach a provided prometheus url' do - let(:prometheus_url) {"https://prometheus.invalid.example.com/api/v1/query?query=1"} + let(:prometheus_url) { "https://prometheus.invalid.example.com/api/v1/query?query=1" } shared_examples 'exceptions are raised' do Gitlab::HTTP::HTTP_ERRORS.each do |error| diff --git a/spec/lib/gitlab/quick_actions/extractor_spec.rb b/spec/lib/gitlab/quick_actions/extractor_spec.rb index c040a70e403..e2f289041ce 100644 --- a/spec/lib/gitlab/quick_actions/extractor_spec.rb +++ b/spec/lib/gitlab/quick_actions/extractor_spec.rb @@ -7,10 +7,10 @@ RSpec.describe Gitlab::QuickActions::Extractor do Class.new do include Gitlab::QuickActions::Dsl - command(:reopen, :open) { } - command(:assign) { } - command(:labels) { } - command(:power) { } + command(:reopen, :open) {} + command(:assign) {} + command(:labels) {} + command(:power) {} command(:noop_command) substitution(:substitution) { 'foo' } substitution :shrug do |comment| diff --git a/spec/lib/gitlab/rack_attack/instrumented_cache_store_spec.rb b/spec/lib/gitlab/rack_attack/instrumented_cache_store_spec.rb index bd167ee2e3e..8151519ddec 100644 --- a/spec/lib/gitlab/rack_attack/instrumented_cache_store_spec.rb +++ b/spec/lib/gitlab/rack_attack/instrumented_cache_store_spec.rb @@ -7,7 +7,7 @@ RSpec.describe Gitlab::RackAttack::InstrumentedCacheStore do let(:store) { ::ActiveSupport::Cache::NullStore.new } - subject { described_class.new(upstream_store: store)} + subject { described_class.new(upstream_store: store) } where(:operation, :params, :test_proc) do :fetch | [:key] | ->(s) { s.fetch(:key) } diff --git a/spec/lib/gitlab/rack_attack/user_allowlist_spec.rb b/spec/lib/gitlab/rack_attack/user_allowlist_spec.rb index aa604dfab71..1b6fa584e3e 100644 --- a/spec/lib/gitlab/rack_attack/user_allowlist_spec.rb +++ b/spec/lib/gitlab/rack_attack/user_allowlist_spec.rb @@ -5,7 +5,7 @@ require 'spec_helper' RSpec.describe Gitlab::RackAttack::UserAllowlist do using RSpec::Parameterized::TableSyntax - subject { described_class.new(input)} + subject { described_class.new(input) } where(:input, :elements) do nil | [] diff --git a/spec/lib/gitlab/redis/hll_spec.rb b/spec/lib/gitlab/redis/hll_spec.rb index e452e5b2f52..9cd339239bb 100644 --- a/spec/lib/gitlab/redis/hll_spec.rb +++ b/spec/lib/gitlab/redis/hll_spec.rb @@ -64,10 +64,10 @@ RSpec.describe Gitlab::Redis::HLL, :clean_gitlab_redis_shared_state do let(:event_2020_33) { '2020-33-{expand_vulnerabilities}' } let(:event_2020_34) { '2020-34-{expand_vulnerabilities}' } - let(:entity1) { 'user_id_1'} - let(:entity2) { 'user_id_2'} - let(:entity3) { 'user_id_3'} - let(:entity4) { 'user_id_4'} + let(:entity1) { 'user_id_1' } + let(:entity2) { 'user_id_2' } + let(:entity3) { 'user_id_3' } + let(:entity4) { 'user_id_4' } before do track_event(event_2020_32, entity1) diff --git a/spec/lib/gitlab/redis/multi_store_spec.rb b/spec/lib/gitlab/redis/multi_store_spec.rb index 50ebf43a05e..ef8549548d7 100644 --- a/spec/lib/gitlab/redis/multi_store_spec.rb +++ b/spec/lib/gitlab/redis/multi_store_spec.rb @@ -23,7 +23,7 @@ RSpec.describe Gitlab::Redis::MultiStore do let_it_be(:primary_store) { create_redis_store(redis_store_class.params, db: primary_db, serializer: nil) } let_it_be(:secondary_store) { create_redis_store(redis_store_class.params, db: secondary_db, serializer: nil) } let_it_be(:instance_name) { 'TestStore' } - let_it_be(:multi_store) { described_class.new(primary_store, secondary_store, instance_name)} + let_it_be(:multi_store) { described_class.new(primary_store, secondary_store, instance_name) } subject { multi_store.send(name, *args) } @@ -38,7 +38,7 @@ RSpec.describe Gitlab::Redis::MultiStore do end context 'when primary_store is nil' do - let(:multi_store) { described_class.new(nil, secondary_store, instance_name)} + let(:multi_store) { described_class.new(nil, secondary_store, instance_name) } it 'fails with exception' do expect { multi_store }.to raise_error(ArgumentError, /primary_store is required/) @@ -46,7 +46,7 @@ RSpec.describe Gitlab::Redis::MultiStore do end context 'when secondary_store is nil' do - let(:multi_store) { described_class.new(primary_store, nil, instance_name)} + let(:multi_store) { described_class.new(primary_store, nil, instance_name) } it 'fails with exception' do expect { multi_store }.to raise_error(ArgumentError, /secondary_store is required/) @@ -55,7 +55,7 @@ RSpec.describe Gitlab::Redis::MultiStore do context 'when instance_name is nil' do let(:instance_name) { nil } - let(:multi_store) { described_class.new(primary_store, secondary_store, instance_name)} + let(:multi_store) { described_class.new(primary_store, secondary_store, instance_name) } it 'fails with exception' do expect { multi_store }.to raise_error(ArgumentError, /instance_name is required/) @@ -111,8 +111,8 @@ RSpec.describe Gitlab::Redis::MultiStore do context 'with READ redis commands' do let_it_be(:key1) { "redis:{1}:key_a" } let_it_be(:key2) { "redis:{1}:key_b" } - let_it_be(:value1) { "redis_value1"} - let_it_be(:value2) { "redis_value2"} + let_it_be(:value1) { "redis_value1" } + let_it_be(:value2) { "redis_value2" } let_it_be(:skey) { "redis:set:key" } let_it_be(:keys) { [key1, key2] } let_it_be(:values) { [value1, value2] } @@ -330,7 +330,7 @@ RSpec.describe Gitlab::Redis::MultiStore do context 'with both primary and secondary store using same redis instance' do let(:primary_store) { create_redis_store(redis_store_class.params, db: primary_db, serializer: nil) } let(:secondary_store) { create_redis_store(redis_store_class.params, db: primary_db, serializer: nil) } - let(:multi_store) { described_class.new(primary_store, secondary_store, instance_name)} + let(:multi_store) { described_class.new(primary_store, secondary_store, instance_name) } it_behaves_like 'secondary store' end @@ -356,8 +356,8 @@ RSpec.describe Gitlab::Redis::MultiStore do context 'with WRITE redis commands' do let_it_be(:key1) { "redis:{1}:key_a" } let_it_be(:key2) { "redis:{1}:key_b" } - let_it_be(:value1) { "redis_value1"} - let_it_be(:value2) { "redis_value2"} + let_it_be(:value1) { "redis_value1" } + let_it_be(:value2) { "redis_value2" } let_it_be(:key1_value1) { [key1, value1] } let_it_be(:key1_value2) { [key1, value2] } let_it_be(:ttl) { 10 } @@ -395,7 +395,7 @@ RSpec.describe Gitlab::Redis::MultiStore do with_them do describe "#{name}" do - let(:expected_args) {args || no_args } + let(:expected_args) { args || no_args } before do allow(primary_store).to receive(name).and_call_original @@ -496,8 +496,8 @@ RSpec.describe Gitlab::Redis::MultiStore do RSpec.shared_examples_for 'pipelined command' do |name| let_it_be(:key1) { "redis:{1}:key_a" } - let_it_be(:value1) { "redis_value1"} - let_it_be(:value2) { "redis_value2"} + let_it_be(:value1) { "redis_value1" } + let_it_be(:value2) { "redis_value2" } let_it_be(:expected_value) { value1 } let_it_be(:verification_name) { :get } let_it_be(:verification_args) { key1 } diff --git a/spec/lib/gitlab/reference_counter_spec.rb b/spec/lib/gitlab/reference_counter_spec.rb index 83e4006c69b..05294fb84e7 100644 --- a/spec/lib/gitlab/reference_counter_spec.rb +++ b/spec/lib/gitlab/reference_counter_spec.rb @@ -41,7 +41,7 @@ RSpec.describe Gitlab::ReferenceCounter, :clean_gitlab_redis_shared_state do it 'resets reference count down to zero' do 3.times { reference_counter.increase } - expect { reference_counter.reset! }.to change { reference_counter.value}.from(3).to(0) + expect { reference_counter.reset! }.to change { reference_counter.value }.from(3).to(0) end end diff --git a/spec/lib/gitlab/regex_spec.rb b/spec/lib/gitlab/regex_spec.rb index a3afbed18e2..d8f182d903d 100644 --- a/spec/lib/gitlab/regex_spec.rb +++ b/spec/lib/gitlab/regex_spec.rb @@ -270,7 +270,7 @@ RSpec.describe Gitlab::Regex do context 'conan recipe components' do shared_examples 'accepting valid recipe components values' do - let(:fifty_one_characters) { 'f_a' * 17} + let(:fifty_one_characters) { 'f_a' * 17 } it { is_expected.to match('foobar') } it { is_expected.to match('foo_bar') } @@ -374,12 +374,12 @@ RSpec.describe Gitlab::Regex do end end - it { is_expected.to match('0')} + it { is_expected.to match('0') } it { is_expected.to match('1') } it { is_expected.to match('03') } it { is_expected.to match('2.0') } it { is_expected.to match('01.2') } - it { is_expected.to match('10.2.3-beta')} + it { is_expected.to match('10.2.3-beta') } it { is_expected.to match('1.2-SNAPSHOT') } it { is_expected.to match('20') } it { is_expected.to match('20.3') } @@ -454,7 +454,7 @@ RSpec.describe Gitlab::Regex do it { is_expected.to match('0.1') } it { is_expected.to match('2.0') } - it { is_expected.to match('1.2.0')} + it { is_expected.to match('1.2.0') } it { is_expected.to match('0100!0.0') } it { is_expected.to match('00!1.2') } it { is_expected.to match('1.0a') } diff --git a/spec/lib/gitlab/search/abuse_detection_spec.rb b/spec/lib/gitlab/search/abuse_detection_spec.rb index a18d28456cd..2a8d74a62ab 100644 --- a/spec/lib/gitlab/search/abuse_detection_spec.rb +++ b/spec/lib/gitlab/search/abuse_detection_spec.rb @@ -5,7 +5,7 @@ require 'spec_helper' RSpec.describe Gitlab::Search::AbuseDetection do subject { described_class.new(params) } - let(:params) {{ query_string: 'foobar' }} + let(:params) { { query_string: 'foobar' } } describe 'abusive scopes validation' do it 'allows only approved scopes' do diff --git a/spec/lib/gitlab/search_context/builder_spec.rb b/spec/lib/gitlab/search_context/builder_spec.rb index a09115f3f21..78799b67a69 100644 --- a/spec/lib/gitlab/search_context/builder_spec.rb +++ b/spec/lib/gitlab/search_context/builder_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe Gitlab::SearchContext::Builder, type: :controller do - controller(ApplicationController) { } + controller(ApplicationController) {} subject(:builder) { described_class.new(controller.view_context) } diff --git a/spec/lib/gitlab/session_spec.rb b/spec/lib/gitlab/session_spec.rb index de680e8425e..67ad59f956d 100644 --- a/spec/lib/gitlab/session_spec.rb +++ b/spec/lib/gitlab/session_spec.rb @@ -19,7 +19,7 @@ RSpec.describe Gitlab::Session do end it 'restores current store after' do - described_class.with_session(two: 2) { } + described_class.with_session(two: 2) {} expect(described_class.current).to eq nil end diff --git a/spec/lib/gitlab/sidekiq_daemon/memory_killer_spec.rb b/spec/lib/gitlab/sidekiq_daemon/memory_killer_spec.rb index b3de80ae3bf..635f572daef 100644 --- a/spec/lib/gitlab/sidekiq_daemon/memory_killer_spec.rb +++ b/spec/lib/gitlab/sidekiq_daemon/memory_killer_spec.rb @@ -106,7 +106,7 @@ RSpec.describe Gitlab::SidekiqDaemon::MemoryKiller do end describe '#stop_working' do - subject { memory_killer.send(:stop_working)} + subject { memory_killer.send(:stop_working) } it 'changes enable? to false' do expect { subject }.to change { memory_killer.send(:enabled?) } diff --git a/spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb b/spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb index 9c0cbe21e6b..e3d9549a3c0 100644 --- a/spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb +++ b/spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb @@ -24,7 +24,7 @@ RSpec.describe Gitlab::SidekiqLogging::StructuredLogger do expect(subject).to receive(:log_job_start).and_call_original expect(subject).to receive(:log_job_done).and_call_original - call_subject(job, 'test_queue') { } + call_subject(job, 'test_queue') {} end end @@ -40,7 +40,7 @@ RSpec.describe Gitlab::SidekiqLogging::StructuredLogger do expect(subject).to receive(:log_job_start).and_call_original expect(subject).to receive(:log_job_done).and_call_original - call_subject(wrapped_job, 'test_queue') { } + call_subject(wrapped_job, 'test_queue') {} end end @@ -175,7 +175,7 @@ RSpec.describe Gitlab::SidekiqLogging::StructuredLogger do expect(subject).to receive(:log_job_start).and_call_original expect(subject).to receive(:log_job_done).and_call_original - call_subject(job, 'test_queue') { } + call_subject(job, 'test_queue') {} end end @@ -188,7 +188,7 @@ RSpec.describe Gitlab::SidekiqLogging::StructuredLogger do expect(subject).to receive(:log_job_start).and_call_original expect(subject).to receive(:log_job_done).and_call_original - call_subject(job.except("created_at", "enqueued_at"), 'test_queue') { } + call_subject(job.except("created_at", "enqueued_at"), 'test_queue') {} end end end @@ -204,7 +204,7 @@ RSpec.describe Gitlab::SidekiqLogging::StructuredLogger do expect(subject).to receive(:log_job_start).and_call_original expect(subject).to receive(:log_job_done).and_call_original - call_subject(job, 'test_queue') { } + call_subject(job, 'test_queue') {} end end end @@ -233,7 +233,7 @@ RSpec.describe Gitlab::SidekiqLogging::StructuredLogger do expect(subject).to receive(:log_job_start).and_call_original expect(subject).to receive(:log_job_done).and_call_original - call_subject(job, 'test_queue') { } + call_subject(job, 'test_queue') {} end end end @@ -266,7 +266,7 @@ RSpec.describe Gitlab::SidekiqLogging::StructuredLogger do expect(logger).to receive(:info).with(start_payload).ordered expect(logger).to receive(:info).with(expected_end_payload).ordered - call_subject(job, 'test_queue') { } + call_subject(job, 'test_queue') {} end end end @@ -330,7 +330,7 @@ RSpec.describe Gitlab::SidekiqLogging::StructuredLogger do Gitlab::SafeRequestStore.clear! - call_subject(job.dup, 'test_queue') { } + call_subject(job.dup, 'test_queue') {} end end diff --git a/spec/lib/gitlab/spamcheck/client_spec.rb b/spec/lib/gitlab/spamcheck/client_spec.rb index bb0b542b4f5..956ed2a976f 100644 --- a/spec/lib/gitlab/spamcheck/client_spec.rb +++ b/spec/lib/gitlab/spamcheck/client_spec.rb @@ -36,7 +36,7 @@ RSpec.describe Gitlab::Spamcheck::Client do let(:stub) { double(:spamcheck_stub, check_for_spam_issue: response) } context 'is tls ' do - let(:endpoint) { 'tls://spamcheck.example.com'} + let(:endpoint) { 'tls://spamcheck.example.com' } it 'uses secure connection' do expect(Spamcheck::SpamcheckService::Stub).to receive(:new).with(endpoint.sub(%r{^tls://}, ''), @@ -118,7 +118,7 @@ RSpec.describe Gitlab::Spamcheck::Client do end context 'when user has multiple email addresses' do - let(:secondary_email) {create(:email, :confirmed, user: user)} + let(:secondary_email) { create(:email, :confirmed, user: user) } before do user.emails << secondary_email diff --git a/spec/lib/gitlab/suggestions/file_suggestion_spec.rb b/spec/lib/gitlab/suggestions/file_suggestion_spec.rb index 1d25bf6edbd..5971f4ebbce 100644 --- a/spec/lib/gitlab/suggestions/file_suggestion_spec.rb +++ b/spec/lib/gitlab/suggestions/file_suggestion_spec.rb @@ -25,7 +25,7 @@ RSpec.describe Gitlab::Suggestions::FileSuggestion do let_it_be(:user) { create(:user) } - let_it_be(:file_path) { 'files/ruby/popen.rb'} + let_it_be(:file_path) { 'files/ruby/popen.rb' } let_it_be(:project) { create(:project, :repository) } diff --git a/spec/lib/gitlab/tracking_spec.rb b/spec/lib/gitlab/tracking_spec.rb index dd62c832f6f..36ef1abcb50 100644 --- a/spec/lib/gitlab/tracking_spec.rb +++ b/spec/lib/gitlab/tracking_spec.rb @@ -181,7 +181,7 @@ RSpec.describe Gitlab::Tracking do let_it_be(:definition_action) { 'definition_action' } let_it_be(:definition_category) { 'definition_category' } let_it_be(:label_description) { 'definition label description' } - let_it_be(:test_definition) {{ 'category': definition_category, 'action': definition_action }} + let_it_be(:test_definition) { { 'category': definition_category, 'action': definition_action } } before do allow_next_instance_of(described_class) do |instance| diff --git a/spec/lib/gitlab/usage/metrics/name_suggestion_spec.rb b/spec/lib/gitlab/usage/metrics/name_suggestion_spec.rb index 9ee8bc6b568..f9cd6e88e0a 100644 --- a/spec/lib/gitlab/usage/metrics/name_suggestion_spec.rb +++ b/spec/lib/gitlab/usage/metrics/name_suggestion_spec.rb @@ -66,7 +66,7 @@ RSpec.describe Gitlab::Usage::Metrics::NameSuggestion do let(:key_path) { 'counts.jira_imports_total_imported_issues_count' } let(:operation) { :sum } let(:relation) { JiraImportState.finished } - let(:column) { :imported_issues_count} + let(:column) { :imported_issues_count } let(:name_suggestion) { /sum_imported_issues_count_from_<adjective describing\: '\(jira_imports\.status = \d+\)'>_jira_imports/ } end end @@ -77,7 +77,7 @@ RSpec.describe Gitlab::Usage::Metrics::NameSuggestion do let(:key_path) { 'counts.ci_pipeline_duration' } let(:operation) { :average } let(:relation) { Ci::Pipeline } - let(:column) { :duration} + let(:column) { :duration } let(:name_suggestion) { /average_duration_from_ci_pipelines/ } end end diff --git a/spec/lib/gitlab/usage/metrics/names_suggestions/generator_spec.rb b/spec/lib/gitlab/usage/metrics/names_suggestions/generator_spec.rb index 167dba9b57d..7e8b15d23db 100644 --- a/spec/lib/gitlab/usage/metrics/names_suggestions/generator_spec.rb +++ b/spec/lib/gitlab/usage/metrics/names_suggestions/generator_spec.rb @@ -17,7 +17,7 @@ RSpec.describe Gitlab::Usage::Metrics::NamesSuggestions::Generator do end describe '#add_metric' do - let(:metric) {'CountIssuesMetric' } + let(:metric) { 'CountIssuesMetric' } it 'computes the suggested name for given metric' do expect(described_class.add_metric(metric)).to eq('count_issues') diff --git a/spec/lib/gitlab/usage_data_counters/ipynb_diff_activity_counter_spec.rb b/spec/lib/gitlab/usage_data_counters/ipynb_diff_activity_counter_spec.rb index 60c4424d2ae..b778f532a11 100644 --- a/spec/lib/gitlab/usage_data_counters/ipynb_diff_activity_counter_spec.rb +++ b/spec/lib/gitlab/usage_data_counters/ipynb_diff_activity_counter_spec.rb @@ -43,18 +43,18 @@ RSpec.describe Gitlab::UsageDataCounters::IpynbDiffActivityCounter, :clean_gitla let(:for_commit) { true } it_behaves_like 'an action that tracks events' do - let(:action) {described_class::NOTE_CREATED_IN_IPYNB_DIFF_ACTION} - let(:per_user_action) {described_class::USER_CREATED_NOTE_IN_IPYNB_DIFF_ACTION} + let(:action) { described_class::NOTE_CREATED_IN_IPYNB_DIFF_ACTION } + let(:per_user_action) { described_class::USER_CREATED_NOTE_IN_IPYNB_DIFF_ACTION } end it_behaves_like 'an action that tracks events' do - let(:action) {described_class::NOTE_CREATED_IN_IPYNB_DIFF_COMMIT_ACTION} - let(:per_user_action) {described_class::USER_CREATED_NOTE_IN_IPYNB_DIFF_COMMIT_ACTION} + let(:action) { described_class::NOTE_CREATED_IN_IPYNB_DIFF_COMMIT_ACTION } + let(:per_user_action) { described_class::USER_CREATED_NOTE_IN_IPYNB_DIFF_COMMIT_ACTION } end it_behaves_like 'an action that does not track events' do - let(:action) {described_class::NOTE_CREATED_IN_IPYNB_DIFF_MR_ACTION} - let(:per_user_action) {described_class::USER_CREATED_NOTE_IN_IPYNB_DIFF_MR_ACTION} + let(:action) { described_class::NOTE_CREATED_IN_IPYNB_DIFF_MR_ACTION } + let(:per_user_action) { described_class::USER_CREATED_NOTE_IN_IPYNB_DIFF_MR_ACTION } end end @@ -62,35 +62,35 @@ RSpec.describe Gitlab::UsageDataCounters::IpynbDiffActivityCounter, :clean_gitla let(:for_mr) { true } it_behaves_like 'an action that tracks events' do - let(:action) {described_class::NOTE_CREATED_IN_IPYNB_DIFF_MR_ACTION} - let(:per_user_action) {described_class::USER_CREATED_NOTE_IN_IPYNB_DIFF_MR_ACTION} + let(:action) { described_class::NOTE_CREATED_IN_IPYNB_DIFF_MR_ACTION } + let(:per_user_action) { described_class::USER_CREATED_NOTE_IN_IPYNB_DIFF_MR_ACTION } end it_behaves_like 'an action that tracks events' do - let(:action) {described_class::NOTE_CREATED_IN_IPYNB_DIFF_ACTION} - let(:per_user_action) {described_class::USER_CREATED_NOTE_IN_IPYNB_DIFF_ACTION} + let(:action) { described_class::NOTE_CREATED_IN_IPYNB_DIFF_ACTION } + let(:per_user_action) { described_class::USER_CREATED_NOTE_IN_IPYNB_DIFF_ACTION } end it_behaves_like 'an action that does not track events' do - let(:action) {described_class::NOTE_CREATED_IN_IPYNB_DIFF_COMMIT_ACTION} - let(:per_user_action) {described_class::USER_CREATED_NOTE_IN_IPYNB_DIFF_COMMIT_ACTION} + let(:action) { described_class::NOTE_CREATED_IN_IPYNB_DIFF_COMMIT_ACTION } + let(:per_user_action) { described_class::USER_CREATED_NOTE_IN_IPYNB_DIFF_COMMIT_ACTION } end end context 'note is for neither MR nor Commit' do it_behaves_like 'an action that does not track events' do - let(:action) {described_class::NOTE_CREATED_IN_IPYNB_DIFF_ACTION} - let(:per_user_action) {described_class::USER_CREATED_NOTE_IN_IPYNB_DIFF_ACTION} + let(:action) { described_class::NOTE_CREATED_IN_IPYNB_DIFF_ACTION } + let(:per_user_action) { described_class::USER_CREATED_NOTE_IN_IPYNB_DIFF_ACTION } end it_behaves_like 'an action that does not track events' do - let(:action) {described_class::NOTE_CREATED_IN_IPYNB_DIFF_MR_ACTION} - let(:per_user_action) {described_class::USER_CREATED_NOTE_IN_IPYNB_DIFF_MR_ACTION} + let(:action) { described_class::NOTE_CREATED_IN_IPYNB_DIFF_MR_ACTION } + let(:per_user_action) { described_class::USER_CREATED_NOTE_IN_IPYNB_DIFF_MR_ACTION } end it_behaves_like 'an action that does not track events' do - let(:action) {described_class::NOTE_CREATED_IN_IPYNB_DIFF_COMMIT_ACTION} - let(:per_user_action) {described_class::USER_CREATED_NOTE_IN_IPYNB_DIFF_COMMIT_ACTION} + let(:action) { described_class::NOTE_CREATED_IN_IPYNB_DIFF_COMMIT_ACTION } + let(:per_user_action) { described_class::USER_CREATED_NOTE_IN_IPYNB_DIFF_COMMIT_ACTION } end end end diff --git a/spec/lib/gitlab/utils/sanitize_node_link_spec.rb b/spec/lib/gitlab/utils/sanitize_node_link_spec.rb index 514051b1cc0..3ab592dfc62 100644 --- a/spec/lib/gitlab/utils/sanitize_node_link_spec.rb +++ b/spec/lib/gitlab/utils/sanitize_node_link_spec.rb @@ -68,7 +68,7 @@ RSpec.describe Gitlab::Utils::SanitizeNodeLink do describe "#safe_protocol?" do let(:doc) { HTML::Pipeline.parse("<a href='#{scheme}alert(1);'>foo</a>") } let(:node) { doc.children.first } - let(:uri) { Addressable::URI.parse(node['href'])} + let(:uri) { Addressable::URI.parse(node['href']) } it "returns false" do expect(object.safe_protocol?(scheme)).to be_falsy diff --git a/spec/lib/gitlab/utils/usage_data_spec.rb b/spec/lib/gitlab/utils/usage_data_spec.rb index 25ba5a3e09e..13d046b0816 100644 --- a/spec/lib/gitlab/utils/usage_data_spec.rb +++ b/spec/lib/gitlab/utils/usage_data_spec.rb @@ -38,7 +38,7 @@ RSpec.describe Gitlab::Utils::UsageData do end describe '#add_metric' do - let(:metric) { 'UuidMetric'} + let(:metric) { 'UuidMetric' } it 'computes the metric value for given metric' do expect(described_class.add_metric(metric)).to eq(Gitlab::CurrentSettings.uuid) diff --git a/spec/lib/gitlab/utils_spec.rb b/spec/lib/gitlab/utils_spec.rb index 0648d276a6b..ad1a65ffae8 100644 --- a/spec/lib/gitlab/utils_spec.rb +++ b/spec/lib/gitlab/utils_spec.rb @@ -115,7 +115,7 @@ RSpec.describe Gitlab::Utils do end it 'raises error for a non-string' do - expect {check_allowed_absolute_path_and_path_traversal!(nil, allowed_paths)}.to raise_error(StandardError) + expect { check_allowed_absolute_path_and_path_traversal!(nil, allowed_paths) }.to raise_error(StandardError) end it 'raises an exception if an absolute path is not allowed' do @@ -128,7 +128,7 @@ RSpec.describe Gitlab::Utils do end describe '.allowlisted?' do - let(:allowed_paths) { ['/home/foo', '/foo/bar', '/etc/passwd']} + let(:allowed_paths) { ['/home/foo', '/foo/bar', '/etc/passwd'] } it 'returns true if path is allowed' do expect(allowlisted?('/foo/bar', allowed_paths)).to be(true) diff --git a/spec/lib/gitlab/verify/uploads_spec.rb b/spec/lib/gitlab/verify/uploads_spec.rb index 3e5154d5029..f9aa196ffde 100644 --- a/spec/lib/gitlab/verify/uploads_spec.rb +++ b/spec/lib/gitlab/verify/uploads_spec.rb @@ -90,7 +90,7 @@ RSpec.describe Gitlab::Verify::Uploads do end def perform_task - described_class.new(batch_size: 100).run_batches { } + described_class.new(batch_size: 100).run_batches {} end end end diff --git a/spec/lib/gitlab/version_info_spec.rb b/spec/lib/gitlab/version_info_spec.rb index 6535c42ad4a..c7db222b9cd 100644 --- a/spec/lib/gitlab/version_info_spec.rb +++ b/spec/lib/gitlab/version_info_spec.rb @@ -79,8 +79,8 @@ RSpec.describe Gitlab::VersionInfo do describe '.unknown' do it { expect(@unknown).not_to be @v0_0_1 } it { expect(@unknown).not_to be described_class.new } - it { expect {@unknown > @v0_0_1}.to raise_error(ArgumentError) } - it { expect {@unknown < @v0_0_1}.to raise_error(ArgumentError) } + it { expect { @unknown > @v0_0_1 }.to raise_error(ArgumentError) } + it { expect { @unknown < @v0_0_1 }.to raise_error(ArgumentError) } end describe '.parse' do diff --git a/spec/lib/json_web_token/rsa_token_spec.rb b/spec/lib/json_web_token/rsa_token_spec.rb index 6d2026752d6..aae1d09d786 100644 --- a/spec/lib/json_web_token/rsa_token_spec.rb +++ b/spec/lib/json_web_token/rsa_token_spec.rb @@ -30,7 +30,7 @@ RSpec.describe JSONWebToken::RSAToken do subject { JWT.decode(rsa_encoded, rsa_key, true, { algorithm: 'RS256' }) } - it { expect {subject}.not_to raise_error } + it { expect { subject }.not_to raise_error } it { expect(subject.first).to include('key' => 'value') } it do expect(subject.second).to eq( @@ -45,7 +45,7 @@ RSpec.describe JSONWebToken::RSAToken do subject { JWT.decode(rsa_encoded, new_key, true, { algorithm: 'RS256' }) } - it { expect {subject}.to raise_error(JWT::DecodeError) } + it { expect { subject }.to raise_error(JWT::DecodeError) } end end end diff --git a/spec/lib/marginalia_spec.rb b/spec/lib/marginalia_spec.rb index 3c8dea547a9..59add4e8347 100644 --- a/spec/lib/marginalia_spec.rb +++ b/spec/lib/marginalia_spec.rb @@ -19,7 +19,7 @@ RSpec.describe 'Marginalia spec' do private [:auth_user, :current_user, :set_experimentation_subject_id_cookie, :signed_in?].each do |method| - define_method(method) { } + define_method(method) {} end end diff --git a/spec/lib/mattermost/session_spec.rb b/spec/lib/mattermost/session_spec.rb index 2158076e4b5..d208ef93224 100644 --- a/spec/lib/mattermost/session_spec.rb +++ b/spec/lib/mattermost/session_spec.rb @@ -25,7 +25,7 @@ RSpec.describe Mattermost::Session, type: :request do describe '#with session' do let(:location) { 'http://location.tld' } - let(:cookie_header) {'MMOAUTH=taskik8az7rq8k6rkpuas7htia; Path=/;'} + let(:cookie_header) { 'MMOAUTH=taskik8az7rq8k6rkpuas7htia; Path=/;' } let!(:stub) do stub_full_request("#{mattermost_url}/oauth/gitlab/login") .to_return(headers: { 'location' => location, 'Set-Cookie' => cookie_header }, status: 302) diff --git a/spec/lib/microsoft_teams/notifier_spec.rb b/spec/lib/microsoft_teams/notifier_spec.rb index 3b7892334dd..905b118d934 100644 --- a/spec/lib/microsoft_teams/notifier_spec.rb +++ b/spec/lib/microsoft_teams/notifier_spec.rb @@ -5,7 +5,7 @@ require 'spec_helper' RSpec.describe MicrosoftTeams::Notifier do subject { described_class.new(webhook_url) } - let(:webhook_url) { 'https://example.gitlab.com/'} + let(:webhook_url) { 'https://example.gitlab.com/' } let(:header) { { 'Content-Type' => 'application/json' } } let(:options) do { diff --git a/spec/lib/sidebars/groups/menus/group_information_menu_spec.rb b/spec/lib/sidebars/groups/menus/group_information_menu_spec.rb index 5f67ee11970..1b27db53b6f 100644 --- a/spec/lib/sidebars/groups/menus/group_information_menu_spec.rb +++ b/spec/lib/sidebars/groups/menus/group_information_menu_spec.rb @@ -18,13 +18,13 @@ RSpec.describe Sidebars::Groups::Menus::GroupInformationMenu do subject { described_class.new(context).title } context 'when group is a root group' do - specify { is_expected.to eq 'Group information'} + specify { is_expected.to eq 'Group information' } end context 'when group is a child group' do let(:group) { build(:group, parent: root_group) } - specify { is_expected.to eq 'Subgroup information'} + specify { is_expected.to eq 'Subgroup information' } end end @@ -32,13 +32,13 @@ RSpec.describe Sidebars::Groups::Menus::GroupInformationMenu do subject { described_class.new(context).sprite_icon } context 'when group is a root group' do - specify { is_expected.to eq 'group'} + specify { is_expected.to eq 'group' } end context 'when group is a child group' do let(:group) { build(:group, parent: root_group) } - specify { is_expected.to eq 'subgroup'} + specify { is_expected.to eq 'subgroup' } end end diff --git a/spec/lib/sidebars/menu_spec.rb b/spec/lib/sidebars/menu_spec.rb index bdd9f22d5a0..53a889c2db8 100644 --- a/spec/lib/sidebars/menu_spec.rb +++ b/spec/lib/sidebars/menu_spec.rb @@ -219,7 +219,7 @@ RSpec.describe Sidebars::Menu do end describe '#link' do - let(:foo_path) { '/foo_path'} + let(:foo_path) { '/foo_path' } let(:foo_menu) do ::Sidebars::MenuItem.new( diff --git a/spec/support/shared_examples/services/boards/lists_move_service_shared_examples.rb b/spec/support/shared_examples/services/boards/lists_move_service_shared_examples.rb index bf84b912610..97d0bae3552 100644 --- a/spec/support/shared_examples/services/boards/lists_move_service_shared_examples.rb +++ b/spec/support/shared_examples/services/boards/lists_move_service_shared_examples.rb @@ -1,95 +1,103 @@ # frozen_string_literal: true RSpec.shared_examples 'lists move service' do - let!(:planning) { create(:list, board: board, position: 0) } - let!(:development) { create(:list, board: board, position: 1) } - let!(:review) { create(:list, board: board, position: 2) } - let!(:staging) { create(:list, board: board, position: 3) } - let!(:closed) { create(:closed_list, board: board) } + shared_examples 'correct movement behavior' do + context 'when list type is set to label' do + it 'does not reorder lists when new position is nil' do + service = described_class.new(parent, user, position: nil) - context 'when list type is set to label' do - it 'keeps position of lists when new position is nil' do - service = described_class.new(parent, user, position: nil) + service.execute(planning) - service.execute(planning) + expect(ordered_lists).to eq([planning, development, review, staging]) + end - expect(current_list_positions).to eq [0, 1, 2, 3] - end - - it 'keeps position of lists when new position is equal to old position' do - service = described_class.new(parent, user, position: planning.position) + it 'does not reorder lists when new position is equal to old position' do + service = described_class.new(parent, user, position: planning.position) - service.execute(planning) + service.execute(planning) - expect(current_list_positions).to eq [0, 1, 2, 3] - end + expect(ordered_lists).to eq([planning, development, review, staging]) + end - it 'keeps position of lists when new position is negative' do - service = described_class.new(parent, user, position: -1) + it 'does not reorder lists when new position is negative' do + service = described_class.new(parent, user, position: -1) - service.execute(planning) + service.execute(planning) - expect(current_list_positions).to eq [0, 1, 2, 3] - end + expect(ordered_lists).to eq([planning, development, review, staging]) + end - it 'keeps position of lists when new position is equal to number of labels lists' do - service = described_class.new(parent, user, position: board.lists.label.size) + it 'does not reorder lists when new position is bigger then last position' do + service = described_class.new(parent, user, position: ordered_lists.last.position + 1) - service.execute(planning) + service.execute(planning) - expect(current_list_positions).to eq [0, 1, 2, 3] - end + expect(ordered_lists).to eq([planning, development, review, staging]) + end - it 'keeps position of lists when new position is greater than number of labels lists' do - service = described_class.new(parent, user, position: board.lists.label.size + 1) + it 'moves the list to the first position when new position is equal to first position' do + service = described_class.new(parent, user, position: 0) - service.execute(planning) + service.execute(staging) - expect(current_list_positions).to eq [0, 1, 2, 3] - end + expect(ordered_lists).to eq([staging, planning, development, review]) + end - it 'increments position of intermediate lists when new position is equal to first position' do - service = described_class.new(parent, user, position: 0) + it 'moves the list to the last position when new position is equal to last position' do + service = described_class.new(parent, user, position: board.lists.label.last.position) - service.execute(staging) + service.execute(planning) - expect(current_list_positions).to eq [1, 2, 3, 0] - end + expect(ordered_lists).to eq([development, review, staging, planning]) + end - it 'decrements position of intermediate lists when new position is equal to last position' do - service = described_class.new(parent, user, position: board.lists.label.last.position) + it 'moves the list to the correct position when new position is greater than old position (third list)' do + service = described_class.new(parent, user, position: review.position) - service.execute(planning) + service.execute(planning) - expect(current_list_positions).to eq [3, 0, 1, 2] - end + expect(ordered_lists).to eq([development, review, planning, staging]) + end - it 'decrements position of intermediate lists when new position is greater than old position' do - service = described_class.new(parent, user, position: 2) + it 'moves the list to the correct position when new position is lower than old position (second list)' do + service = described_class.new(parent, user, position: development.position) - service.execute(planning) + service.execute(staging) - expect(current_list_positions).to eq [2, 0, 1, 3] + expect(ordered_lists).to eq([planning, staging, development, review]) + end end - it 'increments position of intermediate lists when new position is lower than old position' do - service = described_class.new(parent, user, position: 1) + it 'keeps position of lists when list type is closed' do + service = described_class.new(parent, user, position: 2) - service.execute(staging) + service.execute(closed) - expect(current_list_positions).to eq [0, 2, 3, 1] + expect(ordered_lists).to eq([planning, development, review, staging]) end end - it 'keeps position of lists when list type is closed' do - service = described_class.new(parent, user, position: 2) + context 'with complete position sequence' do + let!(:planning) { create(:list, board: board, position: 0) } + let!(:development) { create(:list, board: board, position: 1) } + let!(:review) { create(:list, board: board, position: 2) } + let!(:staging) { create(:list, board: board, position: 3) } + let!(:closed) { create(:closed_list, board: board) } + + it_behaves_like 'correct movement behavior' + end - service.execute(closed) + context 'with corrupted position sequence' do + let!(:planning) { create(:list, board: board, position: 0) } + let!(:staging) { create(:list, board: board, position: 6) } + let!(:development) { create(:list, board: board, position: 1) } + let!(:review) { create(:list, board: board, position: 4) } + let!(:closed) { create(:closed_list, board: board) } - expect(current_list_positions).to eq [0, 1, 2, 3] + it_behaves_like 'correct movement behavior' end - def current_list_positions - [planning, development, review, staging].map { |list| list.reload.position } + def ordered_lists + board.lists.where.not(position: nil) end end diff --git a/spec/tooling/graphql/docs/renderer_spec.rb b/spec/tooling/graphql/docs/renderer_spec.rb index 18256fea2d6..bf2383507aa 100644 --- a/spec/tooling/graphql/docs/renderer_spec.rb +++ b/spec/tooling/graphql/docs/renderer_spec.rb @@ -347,6 +347,128 @@ RSpec.describe Tooling::Graphql::Docs::Renderer do it_behaves_like 'renders correctly as GraphQL documentation' end + context 'when an argument is in alpha' do + let(:type) do + Class.new(Types::BaseObject) do + graphql_name 'AlphaTest' + description 'A thing with arguments in alpha' + + field :foo, + type: GraphQL::Types::String, + null: false, + description: 'A description.' do + argument :foo_arg, GraphQL::Types::String, + required: false, + description: 'Argument description.', + alpha: { milestone: '101.2' } + end + end + end + + let(:section) do + <<~DOC + ##### `AlphaTest.foo` + + A description. + + Returns [`String!`](#string). + + ###### Arguments + + | Name | Type | Description | + | ---- | ---- | ----------- | + | <a id="alphatestfoofooarg"></a>`fooArg` **{warning-solid}** | [`String`](#string) | **Introduced** in 101.2. This feature is in Alpha. It can be changed or removed at any time. Argument description. | + DOC + end + + it_behaves_like 'renders correctly as GraphQL documentation' + end + + context 'when a field is in alpha' do + let(:type) do + Class.new(Types::BaseObject) do + graphql_name 'AlphaTest' + description 'A thing with fields in alpha' + + field :foo, + type: GraphQL::Types::String, + null: false, + alpha: { milestone: '1.10' }, + description: 'A description.' + field :foo_with_args, + type: GraphQL::Types::String, + null: false, + alpha: { milestone: '1.10' }, + description: 'A description.' do + argument :arg, GraphQL::Types::Int, required: false, description: 'Argity' + end + end + end + + let(:section) do + <<~DOC + ### `AlphaTest` + + A thing with fields in alpha. + + #### Fields + + | Name | Type | Description | + | ---- | ---- | ----------- | + | <a id="alphatestfoo"></a>`foo` **{warning-solid}** | [`String!`](#string) | **Introduced** in 1.10. This feature is in Alpha. It can be changed or removed at any time. A description. | + + #### Fields with arguments + + ##### `AlphaTest.fooWithArgs` + + A description. + + WARNING: + **Introduced** in 1.10. + This feature is in Alpha. It can be changed or removed at any time. + + Returns [`String!`](#string). + + ###### Arguments + + | Name | Type | Description | + | ---- | ---- | ----------- | + | <a id="alphatestfoowithargsarg"></a>`arg` | [`Int`](#int) | Argity. | + DOC + end + + it_behaves_like 'renders correctly as GraphQL documentation' + end + + context 'when a Query.field is in alpha' do + before do + query_type.field( + name: :bar, + type: type, + null: true, + description: 'A bar', + alpha: { milestone: '10.11' } + ) + end + + let(:type) { ::GraphQL::Types::Int } + let(:section) do + <<~DOC + ### `Query.bar` + + A bar. + + WARNING: + **Introduced** in 10.11. + This feature is in Alpha. It can be changed or removed at any time. + + Returns [`Int`](#int). + DOC + end + + it_behaves_like 'renders correctly as GraphQL documentation' + end + context 'when a field has an Enumeration type' do let(:type) do enum_type = Class.new(Types::BaseEnum) do diff --git a/tooling/graphql/docs/helper.rb b/tooling/graphql/docs/helper.rb index e4f14129f3b..a76773ed28d 100644 --- a/tooling/graphql/docs/helper.rb +++ b/tooling/graphql/docs/helper.rb @@ -315,14 +315,17 @@ module Tooling def render_deprecation(object, owner, context) buff = [] deprecation = schema_deprecation(owner, object[:name]) + original_description = deprecation&.original_description || render_description_of(object, owner) - buff << (deprecation&.original_description || render_description_of(object, owner)) if context == :block + buff << original_description if context == :block buff << if deprecation deprecation.markdown(context: context) else "**Deprecated:** #{object[:deprecation_reason]}" end + buff << original_description if context == :inline && deprecation&.alpha? + join(context, buff) end |