From 88a161660fc48c4c1a94b51d5c72fdadffc1b1ae Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Fri, 26 Mar 2021 03:09:21 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- .rubocop_todo.yml | 5 -- .../content_viewer/viewers/image_viewer.vue | 4 +- .../container_repositories/destroy_tags.rb | 2 +- app/models/ci/build_trace_chunks/redis.rb | 2 +- app/models/concerns/counter_attribute.rb | 2 +- app/models/design_management/repository.rb | 2 +- app/models/packages/dependency.rb | 4 +- app/models/packages/tag.rb | 2 +- .../nuget/packages_metadata_presenter.rb | 2 +- app/services/concerns/suggestible.rb | 2 +- .../migrate_external_diffs_service.rb | 2 +- app/services/pod_logs/kubernetes_service.rb | 2 +- .../users/batch_status_cleaner_service.rb | 2 +- .../container_expiration_policy_worker.rb | 2 +- ...ve-remaining-unnecessary-use-of-freeze.yml | 5 ++ .../325864-fix-image-blob-rendering.yml | 5 ++ danger/specs/Dangerfile | 6 +- ...ve_terraform_state_verification_indexes.rb | 4 +- ...214032220_add_has_external_wiki_trigger.rb | 8 +-- ...64121_drop_temporary_index_on_ci_builds.rb | 2 +- ...112022_schedule_sync_issuables_state_id.rb | 4 +- ...dule_backfill_push_rules_id_in_projects.rb | 2 +- ...111111_migrate_vulnerability_dismissals.rb | 2 +- .../20200930144340_set_job_waiter_ttl.rb | 2 +- ...521_schedule_sync_blocking_issues_count.rb | 2 +- ...e_backfilling_artifact_expiry_migration.rb | 2 +- ...rojects_with_bad_has_external_wiki_data.rb | 2 +- ...20610_schedule_artifact_expiry_backfill.rb | 6 +- ...ith_bad_has_external_issue_tracker_data.rb | 2 +- ...506_reschedule_artifact_expiry_backfill.rb | 2 +- doc/development/wikis.md | 2 +- doc/user/gitlab_com/index.md | 2 +- doc/user/project/wiki/index.md | 32 +++++----- doc/user/usage_quotas.md | 2 +- lib/banzai/filter/autolink_filter.rb | 2 +- lib/banzai/filter/spaced_link_filter.rb | 2 +- lib/bulk_imports/clients/http.rb | 4 +- lib/gitlab/auth/ldap/adapter.rb | 2 +- lib/gitlab/auth/saml/origin_validator.rb | 2 +- ...culate_vulnerabilities_occurrences_uuid.rb | 2 +- lib/gitlab/ci/queue/metrics.rb | 2 +- .../background_migration/batched_migration.rb | 2 +- lib/gitlab/database/similarity_score.rb | 2 +- lib/gitlab/exclusive_lease.rb | 4 +- lib/gitlab/gitaly_client/storage_settings.rb | 2 +- lib/gitlab/golang.rb | 2 +- .../import_export/base/relation_factory.rb | 2 +- lib/gitlab/middleware/multipart.rb | 2 +- lib/gitlab/middleware/same_site_cookies.rb | 2 +- .../queries/matched_metric_query.rb | 2 +- lib/gitlab/uuid.rb | 2 +- lib/tasks/cache.rake | 2 +- locale/gitlab.pot | 6 ++ ...id_keyword_arguments_in_sidekiq_workers.rb | 2 +- rubocop/cop/gitlab/change_timzone.rb | 2 +- rubocop/cop/qa/ambiguous_page_object_name.rb | 2 +- rubocop/cop/qa/element_with_pattern.rb | 2 +- rubocop/cop/rspec/env_assignment.rb | 2 +- .../cop/rspec/factories_in_migration_specs.rb | 2 +- rubocop/cop/rspec/httparty_basic_auth.rb | 2 +- rubocop/cop/static_translation_definition.rb | 2 +- .../milestones/user_creates_milestone_spec.rb | 2 +- .../branches/user_creates_branch_spec.rb | 4 +- .../comments/user_edits_comments_spec.rb | 2 +- spec/frontend/__helpers__/test_constants.js | 3 + .../viewers/image_viewer_spec.js | 18 ++++-- spec/lib/gitlab/utils_spec.rb | 6 +- spec/rubocop/cop/rspec/env_assignment_spec.rb | 4 +- .../create_dependency_service_spec.rb | 2 +- .../helpers/ci_artifact_metadata_generator.rb | 2 +- spec/support/helpers/jira_service_helper.rb | 2 +- spec/support/helpers/seed_repo.rb | 60 +++++++++---------- 72 files changed, 162 insertions(+), 134 deletions(-) create mode 100644 changelogs/unreleased/31343-remove-remaining-unnecessary-use-of-freeze.yml create mode 100644 changelogs/unreleased/325864-fix-image-blob-rendering.yml diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 35778f056b4..218a002aa45 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -898,11 +898,6 @@ Style/RedundantFetchBlock: Style/RedundantFileExtensionInRequire: Enabled: false -# Offense count: 248 -# Cop supports --auto-correct. -Style/RedundantFreeze: - Enabled: false - # Offense count: 206 # Cop supports --auto-correct. Style/RedundantInterpolation: diff --git a/app/assets/javascripts/vue_shared/components/content_viewer/viewers/image_viewer.vue b/app/assets/javascripts/vue_shared/components/content_viewer/viewers/image_viewer.vue index a49eb7fd611..04ab0fd00aa 100644 --- a/app/assets/javascripts/vue_shared/components/content_viewer/viewers/image_viewer.vue +++ b/app/assets/javascripts/vue_shared/components/content_viewer/viewers/image_viewer.vue @@ -3,6 +3,8 @@ import { throttle } from 'lodash'; import { numberToHumanSize } from '~/lib/utils/number_utils'; import { encodeSaferUrl } from '~/lib/utils/url_utility'; +const BLOB_PREFIX = 'blob:'; + export default { props: { path: { @@ -45,7 +47,7 @@ export default { return this.width && this.height; }, safePath() { - return encodeSaferUrl(this.path); + return this.path.startsWith(BLOB_PREFIX) ? this.path : encodeSaferUrl(this.path); }, }, beforeDestroy() { diff --git a/app/graphql/mutations/container_repositories/destroy_tags.rb b/app/graphql/mutations/container_repositories/destroy_tags.rb index 636ceccee04..12d65f604b8 100644 --- a/app/graphql/mutations/container_repositories/destroy_tags.rb +++ b/app/graphql/mutations/container_repositories/destroy_tags.rb @@ -3,7 +3,7 @@ module Mutations module ContainerRepositories class DestroyTags < ::Mutations::ContainerRepositories::DestroyBase - LIMIT = 20.freeze + LIMIT = 20 TOO_MANY_TAGS_ERROR_MESSAGE = "Number of tags is greater than #{LIMIT}" diff --git a/app/models/ci/build_trace_chunks/redis.rb b/app/models/ci/build_trace_chunks/redis.rb index 58d50b39c11..003ec107895 100644 --- a/app/models/ci/build_trace_chunks/redis.rb +++ b/app/models/ci/build_trace_chunks/redis.rb @@ -4,7 +4,7 @@ module Ci module BuildTraceChunks class Redis CHUNK_REDIS_TTL = 1.week - LUA_APPEND_CHUNK = <<~EOS.freeze + LUA_APPEND_CHUNK = <<~EOS local key, new_data, offset = KEYS[1], ARGV[1], ARGV[2] local length = new_data:len() local expire = #{CHUNK_REDIS_TTL.seconds} diff --git a/app/models/concerns/counter_attribute.rb b/app/models/concerns/counter_attribute.rb index b468415c4c7..829b2a6ef21 100644 --- a/app/models/concerns/counter_attribute.rb +++ b/app/models/concerns/counter_attribute.rb @@ -33,7 +33,7 @@ module CounterAttribute extend AfterCommitQueue include Gitlab::ExclusiveLeaseHelpers - LUA_STEAL_INCREMENT_SCRIPT = <<~EOS.freeze + LUA_STEAL_INCREMENT_SCRIPT = <<~EOS local increment_key, flushed_key = KEYS[1], KEYS[2] local increment_value = redis.call("get", increment_key) or 0 local flushed_value = redis.call("incrby", flushed_key, increment_value) diff --git a/app/models/design_management/repository.rb b/app/models/design_management/repository.rb index 985d6317d5d..2b1e6070e6b 100644 --- a/app/models/design_management/repository.rb +++ b/app/models/design_management/repository.rb @@ -8,7 +8,7 @@ module DesignManagement # repository is entirely GitLab-managed rather than user-facing. # # Enable all uploaded files to be stored in LFS. - MANAGED_GIT_ATTRIBUTES = <<~GA.freeze + MANAGED_GIT_ATTRIBUTES = <<~GA /#{DesignManagement.designs_directory}/* filter=lfs diff=lfs merge=lfs -text GA diff --git a/app/models/packages/dependency.rb b/app/models/packages/dependency.rb index a32c3c05bb3..ad3944b5f21 100644 --- a/app/models/packages/dependency.rb +++ b/app/models/packages/dependency.rb @@ -7,8 +7,8 @@ class Packages::Dependency < ApplicationRecord validates :name, uniqueness: { scope: :version_pattern } NAME_VERSION_PATTERN_TUPLE_MATCHING = '(name, version_pattern) = (?, ?)' - MAX_STRING_LENGTH = 255.freeze - MAX_CHUNKED_QUERIES_COUNT = 10.freeze + MAX_STRING_LENGTH = 255 + MAX_CHUNKED_QUERIES_COUNT = 10 def self.ids_for_package_names_and_version_patterns(names_and_version_patterns = {}, chunk_size = 50, max_rows_limit = 200) names_and_version_patterns.reject! { |key, value| key.size > MAX_STRING_LENGTH || value.size > MAX_STRING_LENGTH } diff --git a/app/models/packages/tag.rb b/app/models/packages/tag.rb index 771d016daed..14a1ae98ed4 100644 --- a/app/models/packages/tag.rb +++ b/app/models/packages/tag.rb @@ -4,7 +4,7 @@ class Packages::Tag < ApplicationRecord validates :package, :name, presence: true - FOR_PACKAGES_TAGS_LIMIT = 200.freeze + FOR_PACKAGES_TAGS_LIMIT = 200 NUGET_TAGS_SEPARATOR = ' ' # https://docs.microsoft.com/en-us/nuget/reference/nuspec#tags scope :preload_package, -> { preload(:package) } diff --git a/app/presenters/packages/nuget/packages_metadata_presenter.rb b/app/presenters/packages/nuget/packages_metadata_presenter.rb index 5f22d5dd8a1..5f5859d46c9 100644 --- a/app/presenters/packages/nuget/packages_metadata_presenter.rb +++ b/app/presenters/packages/nuget/packages_metadata_presenter.rb @@ -6,7 +6,7 @@ module Packages include Packages::Nuget::PresenterHelpers include Gitlab::Utils::StrongMemoize - COUNT = 1.freeze + COUNT = 1 def initialize(packages) @packages = packages diff --git a/app/services/concerns/suggestible.rb b/app/services/concerns/suggestible.rb index 0cba9bf1b8a..82e43c856f8 100644 --- a/app/services/concerns/suggestible.rb +++ b/app/services/concerns/suggestible.rb @@ -5,7 +5,7 @@ module Suggestible include Gitlab::Utils::StrongMemoize # This translates into limiting suggestion changes to `suggestion:-100+100`. - MAX_LINES_CONTEXT = 100.freeze + MAX_LINES_CONTEXT = 100 def diff_lines strong_memoize(:diff_lines) do diff --git a/app/services/merge_requests/migrate_external_diffs_service.rb b/app/services/merge_requests/migrate_external_diffs_service.rb index 89b1e594c95..b1d2cd5d1c7 100644 --- a/app/services/merge_requests/migrate_external_diffs_service.rb +++ b/app/services/merge_requests/migrate_external_diffs_service.rb @@ -2,7 +2,7 @@ module MergeRequests class MigrateExternalDiffsService < ::BaseService - MAX_JOBS = 1000.freeze + MAX_JOBS = 1000 attr_reader :diff diff --git a/app/services/pod_logs/kubernetes_service.rb b/app/services/pod_logs/kubernetes_service.rb index 03b84f98973..28b1a179635 100644 --- a/app/services/pod_logs/kubernetes_service.rb +++ b/app/services/pod_logs/kubernetes_service.rb @@ -2,7 +2,7 @@ module PodLogs class KubernetesService < PodLogs::BaseService - LOGS_LIMIT = 500.freeze + LOGS_LIMIT = 500 REPLACEMENT_CHAR = "\u{FFFD}" EncodingHelperError = Class.new(StandardError) diff --git a/app/services/users/batch_status_cleaner_service.rb b/app/services/users/batch_status_cleaner_service.rb index ea6142f13cc..533794f8d60 100644 --- a/app/services/users/batch_status_cleaner_service.rb +++ b/app/services/users/batch_status_cleaner_service.rb @@ -2,7 +2,7 @@ module Users class BatchStatusCleanerService - BATCH_SIZE = 100.freeze + BATCH_SIZE = 100 # Cleanup BATCH_SIZE user_statuses records # rubocop: disable CodeReuse/ActiveRecord diff --git a/app/workers/container_expiration_policy_worker.rb b/app/workers/container_expiration_policy_worker.rb index 43dbea027f2..b855d2a6998 100644 --- a/app/workers/container_expiration_policy_worker.rb +++ b/app/workers/container_expiration_policy_worker.rb @@ -9,7 +9,7 @@ class ContainerExpirationPolicyWorker # rubocop:disable Scalability/IdempotentWo InvalidPolicyError = Class.new(StandardError) - BATCH_SIZE = 1000.freeze + BATCH_SIZE = 1000 def perform throttling_enabled? ? perform_throttled : perform_unthrottled diff --git a/changelogs/unreleased/31343-remove-remaining-unnecessary-use-of-freeze.yml b/changelogs/unreleased/31343-remove-remaining-unnecessary-use-of-freeze.yml new file mode 100644 index 00000000000..7885caf1a4f --- /dev/null +++ b/changelogs/unreleased/31343-remove-remaining-unnecessary-use-of-freeze.yml @@ -0,0 +1,5 @@ +--- +title: Enable RedundantFreeze Cop and Remove Remaining Offenses +merge_request: 57288 +author: Lee Tickett @leetickett +type: other diff --git a/changelogs/unreleased/325864-fix-image-blob-rendering.yml b/changelogs/unreleased/325864-fix-image-blob-rendering.yml new file mode 100644 index 00000000000..fa07c4abfc0 --- /dev/null +++ b/changelogs/unreleased/325864-fix-image-blob-rendering.yml @@ -0,0 +1,5 @@ +--- +title: Fixed rendering of the image blobs +merge_request: 57479 +author: +type: fixed diff --git a/danger/specs/Dangerfile b/danger/specs/Dangerfile index 26b52f64f2e..35476ae645d 100644 --- a/danger/specs/Dangerfile +++ b/danger/specs/Dangerfile @@ -7,12 +7,12 @@ NO_SPECS_LABELS = [ 'documentation', 'QA' ].freeze -NO_NEW_SPEC_MESSAGE = <<~MSG.freeze +NO_NEW_SPEC_MESSAGE = <<~MSG You've made some app changes, but didn't add any tests. That's OK as long as you're refactoring existing code, but please consider adding any of the %s labels. MSG -EE_CHANGE_WITH_FOSS_SPEC_CHANGE_MESSAGE = <<~MSG.freeze +EE_CHANGE_WITH_FOSS_SPEC_CHANGE_MESSAGE = <<~MSG You've made some EE-specific changes, but only made changes to FOSS tests. This could be a sign that you're testing an EE-specific behavior in a FOSS test. @@ -24,7 +24,7 @@ Please make sure the spec files pass in AS-IF-FOSS mode either: MSG -CONTROLLER_SPEC_DEPRECATION_MESSAGE = <<~MSG.freeze +CONTROLLER_SPEC_DEPRECATION_MESSAGE = <<~MSG Do not add new controller specs. We are moving from controller specs to request specs (and/or feature specs). Please add request specs under `/spec/requests` and/or `/ee/spec/requests` instead. diff --git a/db/migrate/20200928233632_remove_terraform_state_verification_indexes.rb b/db/migrate/20200928233632_remove_terraform_state_verification_indexes.rb index 0256d580cd6..b5a7bb5e39d 100644 --- a/db/migrate/20200928233632_remove_terraform_state_verification_indexes.rb +++ b/db/migrate/20200928233632_remove_terraform_state_verification_indexes.rb @@ -4,8 +4,8 @@ class RemoveTerraformStateVerificationIndexes < ActiveRecord::Migration[6.0] include Gitlab::Database::MigrationHelpers DOWNTIME = false - CHECKSUM_INDEX_NAME = "terraform_states_verification_checksum_partial".freeze - FAILURE_INDEX_NAME = "terraform_states_verification_failure_partial".freeze + CHECKSUM_INDEX_NAME = "terraform_states_verification_checksum_partial" + FAILURE_INDEX_NAME = "terraform_states_verification_failure_partial" disable_ddl_transaction! diff --git a/db/migrate/20201214032220_add_has_external_wiki_trigger.rb b/db/migrate/20201214032220_add_has_external_wiki_trigger.rb index f6e066b75da..c77b887d509 100644 --- a/db/migrate/20201214032220_add_has_external_wiki_trigger.rb +++ b/db/migrate/20201214032220_add_has_external_wiki_trigger.rb @@ -4,10 +4,10 @@ class AddHasExternalWikiTrigger < ActiveRecord::Migration[6.0] include Gitlab::Database::SchemaHelpers DOWNTIME = false - FUNCTION_NAME = 'set_has_external_wiki'.freeze - TRIGGER_ON_INSERT_NAME = 'trigger_has_external_wiki_on_insert'.freeze - TRIGGER_ON_UPDATE_NAME = 'trigger_has_external_wiki_on_update'.freeze - TRIGGER_ON_DELETE_NAME = 'trigger_has_external_wiki_on_delete'.freeze + FUNCTION_NAME = 'set_has_external_wiki' + TRIGGER_ON_INSERT_NAME = 'trigger_has_external_wiki_on_insert' + TRIGGER_ON_UPDATE_NAME = 'trigger_has_external_wiki_on_update' + TRIGGER_ON_DELETE_NAME = 'trigger_has_external_wiki_on_delete' def up create_trigger_function(FUNCTION_NAME, replace: true) do diff --git a/db/migrate/20210102164121_drop_temporary_index_on_ci_builds.rb b/db/migrate/20210102164121_drop_temporary_index_on_ci_builds.rb index 0ecf194eb97..9c99414792e 100644 --- a/db/migrate/20210102164121_drop_temporary_index_on_ci_builds.rb +++ b/db/migrate/20210102164121_drop_temporary_index_on_ci_builds.rb @@ -7,7 +7,7 @@ class DropTemporaryIndexOnCiBuilds < ActiveRecord::Migration[6.0] disable_ddl_transaction! - INDEX = 'tmp_build_stage_position_index'.freeze + INDEX = 'tmp_build_stage_position_index' def up remove_concurrent_index_by_name :ci_builds, INDEX diff --git a/db/post_migrate/20190214112022_schedule_sync_issuables_state_id.rb b/db/post_migrate/20190214112022_schedule_sync_issuables_state_id.rb index 34536e22bbf..de062937fbe 100644 --- a/db/post_migrate/20190214112022_schedule_sync_issuables_state_id.rb +++ b/db/post_migrate/20190214112022_schedule_sync_issuables_state_id.rb @@ -19,8 +19,8 @@ class ScheduleSyncIssuablesStateId < ActiveRecord::Migration[5.0] # BATCH_SIZE = 5000 DELAY_INTERVAL = 120.seconds.to_i - ISSUES_MIGRATION = 'SyncIssuesStateId'.freeze - MERGE_REQUESTS_MIGRATION = 'SyncMergeRequestsStateId'.freeze + ISSUES_MIGRATION = 'SyncIssuesStateId' + MERGE_REQUESTS_MIGRATION = 'SyncMergeRequestsStateId' disable_ddl_transaction! diff --git a/db/post_migrate/20200325162730_schedule_backfill_push_rules_id_in_projects.rb b/db/post_migrate/20200325162730_schedule_backfill_push_rules_id_in_projects.rb index 8ff3ab6aa0c..984f4f20441 100644 --- a/db/post_migrate/20200325162730_schedule_backfill_push_rules_id_in_projects.rb +++ b/db/post_migrate/20200325162730_schedule_backfill_push_rules_id_in_projects.rb @@ -5,7 +5,7 @@ class ScheduleBackfillPushRulesIdInProjects < ActiveRecord::Migration[6.0] disable_ddl_transaction! - MIGRATION = 'BackfillPushRulesIdInProjects'.freeze + MIGRATION = 'BackfillPushRulesIdInProjects' BATCH_SIZE = 1_000 class PushRules < ActiveRecord::Base diff --git a/db/post_migrate/20200416111111_migrate_vulnerability_dismissals.rb b/db/post_migrate/20200416111111_migrate_vulnerability_dismissals.rb index 6ec8b991968..6ca3db8902b 100644 --- a/db/post_migrate/20200416111111_migrate_vulnerability_dismissals.rb +++ b/db/post_migrate/20200416111111_migrate_vulnerability_dismissals.rb @@ -7,7 +7,7 @@ class MigrateVulnerabilityDismissals < ActiveRecord::Migration[6.0] disable_ddl_transaction! - MIGRATION = 'UpdateVulnerabilitiesToDismissed'.freeze + MIGRATION = 'UpdateVulnerabilitiesToDismissed' BATCH_SIZE = 500 DELAY_INTERVAL = 2.minutes.to_i diff --git a/db/post_migrate/20200930144340_set_job_waiter_ttl.rb b/db/post_migrate/20200930144340_set_job_waiter_ttl.rb index b15faa61dea..347fa4be5a0 100644 --- a/db/post_migrate/20200930144340_set_job_waiter_ttl.rb +++ b/db/post_migrate/20200930144340_set_job_waiter_ttl.rb @@ -3,7 +3,7 @@ class SetJobWaiterTtl < ActiveRecord::Migration[6.0] DOWNTIME = false - SCRIPT = <<~LUA.freeze + SCRIPT = <<~LUA if redis.call("ttl", KEYS[1]) < 0 then redis.call("expire", KEYS[1], 21600) end diff --git a/db/post_migrate/20201014142521_schedule_sync_blocking_issues_count.rb b/db/post_migrate/20201014142521_schedule_sync_blocking_issues_count.rb index 61b2b2aaad5..30a8ea591da 100644 --- a/db/post_migrate/20201014142521_schedule_sync_blocking_issues_count.rb +++ b/db/post_migrate/20201014142521_schedule_sync_blocking_issues_count.rb @@ -7,7 +7,7 @@ class ScheduleSyncBlockingIssuesCount < ActiveRecord::Migration[6.0] BATCH_SIZE = 50 DELAY_INTERVAL = 120.seconds.to_i - MIGRATION = 'SyncBlockingIssuesCount'.freeze + MIGRATION = 'SyncBlockingIssuesCount' disable_ddl_transaction! diff --git a/db/post_migrate/20201208175117_schedule_backfilling_artifact_expiry_migration.rb b/db/post_migrate/20201208175117_schedule_backfilling_artifact_expiry_migration.rb index 1ffe9abbc58..56db148afe6 100644 --- a/db/post_migrate/20201208175117_schedule_backfilling_artifact_expiry_migration.rb +++ b/db/post_migrate/20201208175117_schedule_backfilling_artifact_expiry_migration.rb @@ -5,7 +5,7 @@ class ScheduleBackfillingArtifactExpiryMigration < ActiveRecord::Migration[6.0] DOWNTIME = false SWITCH_DATE = Time.utc(2020, 6, 22).freeze - INDEX_NAME = 'expired_artifacts_temp_index'.freeze + INDEX_NAME = 'expired_artifacts_temp_index' INDEX_CONDITION = "expire_at IS NULL AND created_at < '#{SWITCH_DATE}'" disable_ddl_transaction! diff --git a/db/post_migrate/20210105030125_cleanup_projects_with_bad_has_external_wiki_data.rb b/db/post_migrate/20210105030125_cleanup_projects_with_bad_has_external_wiki_data.rb index faaa3f47e57..bc90a5f48ea 100644 --- a/db/post_migrate/20210105030125_cleanup_projects_with_bad_has_external_wiki_data.rb +++ b/db/post_migrate/20210105030125_cleanup_projects_with_bad_has_external_wiki_data.rb @@ -4,7 +4,7 @@ class CleanupProjectsWithBadHasExternalWikiData < ActiveRecord::Migration[6.0] include Gitlab::Database::MigrationHelpers DOWNTIME = false - TMP_INDEX_NAME = 'tmp_index_projects_on_id_where_has_external_wiki_is_true'.freeze + TMP_INDEX_NAME = 'tmp_index_projects_on_id_where_has_external_wiki_is_true' BATCH_SIZE = 100 disable_ddl_transaction! diff --git a/db/post_migrate/20210115220610_schedule_artifact_expiry_backfill.rb b/db/post_migrate/20210115220610_schedule_artifact_expiry_backfill.rb index 44a76321495..4f49e8b75af 100644 --- a/db/post_migrate/20210115220610_schedule_artifact_expiry_backfill.rb +++ b/db/post_migrate/20210115220610_schedule_artifact_expiry_backfill.rb @@ -4,11 +4,11 @@ class ScheduleArtifactExpiryBackfill < ActiveRecord::Migration[6.0] include Gitlab::Database::MigrationHelpers DOWNTIME = false - MIGRATION = 'BackfillArtifactExpiryDate'.freeze + MIGRATION = 'BackfillArtifactExpiryDate' SWITCH_DATE = Date.new(2020, 06, 22).freeze - INDEX_NAME = 'expired_artifacts_temp_index'.freeze + INDEX_NAME = 'expired_artifacts_temp_index' OLD_INDEX_CONDITION = "expire_at IS NULL AND created_at < '#{SWITCH_DATE}'" - INDEX_CONDITION = "expire_at IS NULL AND date(created_at AT TIME ZONE 'UTC') < '2020-06-22'::date".freeze + INDEX_CONDITION = "expire_at IS NULL AND date(created_at AT TIME ZONE 'UTC') < '2020-06-22'::date" disable_ddl_transaction! diff --git a/db/post_migrate/20210210221006_cleanup_projects_with_bad_has_external_issue_tracker_data.rb b/db/post_migrate/20210210221006_cleanup_projects_with_bad_has_external_issue_tracker_data.rb index 25ef93e692b..7b17faeb4b4 100644 --- a/db/post_migrate/20210210221006_cleanup_projects_with_bad_has_external_issue_tracker_data.rb +++ b/db/post_migrate/20210210221006_cleanup_projects_with_bad_has_external_issue_tracker_data.rb @@ -4,7 +4,7 @@ class CleanupProjectsWithBadHasExternalIssueTrackerData < ActiveRecord::Migratio include Gitlab::Database::MigrationHelpers DOWNTIME = false - TMP_INDEX_NAME = 'tmp_idx_projects_on_id_where_has_external_issue_tracker_is_true'.freeze + TMP_INDEX_NAME = 'tmp_idx_projects_on_id_where_has_external_issue_tracker_is_true' BATCH_SIZE = 100 disable_ddl_transaction! diff --git a/db/post_migrate/20210224150506_reschedule_artifact_expiry_backfill.rb b/db/post_migrate/20210224150506_reschedule_artifact_expiry_backfill.rb index af5c474e2ba..2c0fe405490 100644 --- a/db/post_migrate/20210224150506_reschedule_artifact_expiry_backfill.rb +++ b/db/post_migrate/20210224150506_reschedule_artifact_expiry_backfill.rb @@ -4,7 +4,7 @@ class RescheduleArtifactExpiryBackfill < ActiveRecord::Migration[6.0] include Gitlab::Database::MigrationHelpers DOWNTIME = false - MIGRATION = 'BackfillArtifactExpiryDate'.freeze + MIGRATION = 'BackfillArtifactExpiryDate' SWITCH_DATE = Date.new(2020, 06, 22).freeze disable_ddl_transaction! diff --git a/doc/development/wikis.md b/doc/development/wikis.md index f47c87137ae..fb1755053aa 100644 --- a/doc/development/wikis.md +++ b/doc/development/wikis.md @@ -19,7 +19,7 @@ Wikis use Git repositories as storage backend, and can be accessed through: - The [Web UI](../user/project/wiki/index.md) - The [REST API](../api/wikis.md) -- [Git itself](../user/project/wiki/#adding-and-editing-wiki-pages-locally) +- [Git itself](../user/project/wiki/index.md#create-or-edit-wiki-pages-locally) [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/2214) in GitLab 13.5, wikis are also available for groups, in addition to projects. diff --git a/doc/user/gitlab_com/index.md b/doc/user/gitlab_com/index.md index 76a35454f71..6d4f8688099 100644 --- a/doc/user/gitlab_com/index.md +++ b/doc/user/gitlab_com/index.md @@ -50,7 +50,7 @@ Projects can be backed up in their entirety by exporting them either [through th With exports, be sure to take note of [what is and is not](../project/settings/import_export.md#exported-contents), included in a project export. -Since GitLab is built on Git, you can back up **just** the repository of a project by [cloning](../../gitlab-basics/start-using-git.md#clone-a-repository) it to another machine. Similarly, if you need to back up just the wiki of a repository it can also be cloned and all files uploaded to that wiki are included [if they were uploaded after 2020-08-22](../project/wiki/index.md#creating-a-new-wiki-page). +Since GitLab is built on Git, you can back up **just** the repository of a project by [cloning](../../gitlab-basics/start-using-git.md#clone-a-repository) it to another machine. Similarly, if you need to back up just the wiki of a repository it can also be cloned and all files uploaded to that wiki are included [if they were uploaded after 2020-08-22](../project/wiki/index.md#create-a-new-wiki-page). ## Alternative SSH port diff --git a/doc/user/project/wiki/index.md b/doc/user/project/wiki/index.md index eb8270b8740..224042406cb 100644 --- a/doc/user/project/wiki/index.md +++ b/doc/user/project/wiki/index.md @@ -16,13 +16,13 @@ repository, but you do want to keep it in the same project where your code resides. You can create Wiki pages in the web interface or -[locally using Git](#adding-and-editing-wiki-pages-locally) since every Wiki is +[locally using Git](#create-or-edit-wiki-pages-locally) since every Wiki is a separate Git repository. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/13195) in [GitLab Premium](https://about.gitlab.com/pricing/) 13.5, **group wikis** became available. Their usage is similar to project wikis, with a few [limitations](../../group/index.md#group-wikis). -## First time creating the Home page +## Create the wiki home page The first time you visit a Wiki, you are directed to create the Home page. The Home page is necessary to be created because it serves as the landing page @@ -32,7 +32,7 @@ message. ![New home page](img/wiki_create_home_page.png) -## Creating a new wiki page +## Create a new wiki page NOTE: Requires Developer [permissions](../../permissions.md). @@ -60,7 +60,7 @@ When you're ready, select **Create page** and the new page is created. ![New page](img/wiki_create_new_page.png) -### Attachment storage +### Store attachments for wiki pages > - [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/33475) in GitLab 11.3. @@ -94,7 +94,7 @@ Please note that: - Non-ASCII characters take up more than one byte. - It's still possible to create files and directories exceeding those limits locally through Git, but this might break on other people's machines. -## Editing a wiki page +## Edit a wiki page You need Developer [permissions](../../permissions.md) or higher to edit a wiki page. To do so: @@ -103,12 +103,12 @@ To do so: 1. Edit the content. 1. Select **Save changes**. -### Adding a table of contents +### Create a table of contents To generate a table of contents from the headings in a Wiki page, use the `[[_TOC_]]` tag. For an example, see [Table of contents](../../markdown.md#table-of-contents). -## Deleting a wiki page +## Delete a wiki page You need Maintainer [permissions](../../permissions.md) or higher to delete a wiki page. To do so: @@ -117,7 +117,7 @@ To do so: 1. Select **Delete page**. 1. Confirm the deletion. -## Moving a wiki page +## Move a wiki page You need Developer [permissions](../../permissions.md) or higher to move a wiki page. To do so: @@ -139,7 +139,7 @@ If you want to do the opposite: 1. Change the **Title** from `about` to `company/about`. 1. Select **Save changes**. -## Viewing a list of all created wiki pages +## View list of all wiki pages > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/17673/) in GitLab 13.5, wiki pages are displayed as a nested tree in the sidebar and pages overview. @@ -151,7 +151,7 @@ found. The list is ordered alphabetically. If you have many pages, not all are listed in the sidebar. Select **View All Pages** to see all of them. -## Viewing the history of a wiki page +## View history of a wiki page The changes of a wiki page over time are recorded in the wiki's Git repository, and you can view them by selecting **Page history**. @@ -163,7 +163,7 @@ number in the **Page version** column. ![Wiki page history](img/wiki_page_history.png) -### Viewing the changes between page versions +### View changes between page versions > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/15242) in GitLab 13.2. @@ -175,7 +175,7 @@ Similar to versioned diff file views, you can see the changes made in a given Wi ![Wiki page changes](img/wiki_page_diffs_v13_2.png) -## Wiki activity records +## Track wiki events > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/14902) in **GitLab 12.10.** > - Git events were [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/216014) in **GitLab 13.0.** @@ -186,7 +186,7 @@ displayed on the [user profile](../../profile/index.md#access-your-user-profile) [group](../../group/index.md#view-group-activity), and [project](../working_with_projects.md#project-activity) activity pages. -## Adding and editing wiki pages locally +## Create or edit wiki pages locally Since wikis are based on Git repositories, you can clone them locally and edit them like you would do with every other Git repository. @@ -202,7 +202,7 @@ otherwise they don't display when pushed to GitLab: - AsciiDoc extensions: `.adoc`, `.ad`, `.asciidoc`. - Other markup extensions: `.textile`, `.rdoc`, `.org`, `.creole`, `.wiki`, `.mediawiki`, `.rst`. -## Customizing sidebar +## Customize sidebar > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/23109) in GitLab 13.8, the sidebar can be customized by selecting the **Edit sidebar** button. @@ -225,3 +225,7 @@ Example for `_sidebar` (using Markdown format): ``` Support for displaying a generated table of contents with a custom side navigation is planned. + +## Resources + +- [Group wikis](../../group/index.md#group-wikis) diff --git a/doc/user/usage_quotas.md b/doc/user/usage_quotas.md index 16ba2582101..07a5eda8cfb 100644 --- a/doc/user/usage_quotas.md +++ b/doc/user/usage_quotas.md @@ -5,7 +5,7 @@ group: Utilization 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/#designated-technical-writers --- -# Storage usage quota +# Storage usage quota **(FREE SAAS)** > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/13294) in GitLab 12.0. > - Moved to GitLab Free. diff --git a/lib/banzai/filter/autolink_filter.rb b/lib/banzai/filter/autolink_filter.rb index d569711431c..a86c1bb2892 100644 --- a/lib/banzai/filter/autolink_filter.rb +++ b/lib/banzai/filter/autolink_filter.rb @@ -43,7 +43,7 @@ module Banzai TEXT_QUERY = %Q(descendant-or-self::text()[ not(#{IGNORE_PARENTS.map { |p| "ancestor::#{p}" }.join(' or ')}) and contains(., '://') - ]).freeze + ]) PUNCTUATION_PAIRS = { "'" => "'", diff --git a/lib/banzai/filter/spaced_link_filter.rb b/lib/banzai/filter/spaced_link_filter.rb index f52ffe117d9..ca26e6d1581 100644 --- a/lib/banzai/filter/spaced_link_filter.rb +++ b/lib/banzai/filter/spaced_link_filter.rb @@ -42,7 +42,7 @@ module Banzai TEXT_QUERY = %Q(descendant-or-self::text()[ not(#{IGNORE_PARENTS.map { |p| "ancestor::#{p}" }.join(' or ')}) and contains(., ']\(') - ]).freeze + ]) def call doc.xpath(TEXT_QUERY).each do |node| diff --git a/lib/bulk_imports/clients/http.rb b/lib/bulk_imports/clients/http.rb index acc94d5ff2e..dcd6830bf67 100644 --- a/lib/bulk_imports/clients/http.rb +++ b/lib/bulk_imports/clients/http.rb @@ -4,8 +4,8 @@ module BulkImports module Clients class Http API_VERSION = 'v4' - DEFAULT_PAGE = 1.freeze - DEFAULT_PER_PAGE = 30.freeze + DEFAULT_PAGE = 1 + DEFAULT_PER_PAGE = 30 ConnectionError = Class.new(StandardError) diff --git a/lib/gitlab/auth/ldap/adapter.rb b/lib/gitlab/auth/ldap/adapter.rb index b7bb61f0677..7f85d3b1cd3 100644 --- a/lib/gitlab/auth/ldap/adapter.rb +++ b/lib/gitlab/auth/ldap/adapter.rb @@ -5,7 +5,7 @@ module Gitlab module Ldap class Adapter SEARCH_RETRY_FACTOR = [1, 1, 2, 3].freeze - MAX_SEARCH_RETRIES = Rails.env.test? ? 1 : SEARCH_RETRY_FACTOR.size.freeze + MAX_SEARCH_RETRIES = Rails.env.test? ? 1 : SEARCH_RETRY_FACTOR.size attr_reader :provider, :ldap diff --git a/lib/gitlab/auth/saml/origin_validator.rb b/lib/gitlab/auth/saml/origin_validator.rb index 4ecc688888f..ff0d25314f7 100644 --- a/lib/gitlab/auth/saml/origin_validator.rb +++ b/lib/gitlab/auth/saml/origin_validator.rb @@ -4,7 +4,7 @@ module Gitlab module Auth module Saml class OriginValidator - AUTH_REQUEST_SESSION_KEY = "last_authn_request_id".freeze + AUTH_REQUEST_SESSION_KEY = "last_authn_request_id" def initialize(session) @session = session || {} diff --git a/lib/gitlab/background_migration/recalculate_vulnerabilities_occurrences_uuid.rb b/lib/gitlab/background_migration/recalculate_vulnerabilities_occurrences_uuid.rb index 7b18e617c81..888a12f2330 100644 --- a/lib/gitlab/background_migration/recalculate_vulnerabilities_occurrences_uuid.rb +++ b/lib/gitlab/background_migration/recalculate_vulnerabilities_occurrences_uuid.rb @@ -32,7 +32,7 @@ class Gitlab::BackgroundMigration::RecalculateVulnerabilitiesOccurrencesUuid }.freeze NAMESPACE_REGEX = /(\h{8})-(\h{4})-(\h{4})-(\h{4})-(\h{4})(\h{8})/.freeze - PACK_PATTERN = "NnnnnN".freeze + PACK_PATTERN = "NnnnnN" def self.call(value) Digest::UUID.uuid_v5(namespace_id, value) diff --git a/lib/gitlab/ci/queue/metrics.rb b/lib/gitlab/ci/queue/metrics.rb index 35ac4e36030..fd02c998d84 100644 --- a/lib/gitlab/ci/queue/metrics.rb +++ b/lib/gitlab/ci/queue/metrics.rb @@ -14,7 +14,7 @@ module Gitlab METRICS_SHARD_TAG_PREFIX = 'metrics_shard::' DEFAULT_METRICS_SHARD = 'default' - JOBS_RUNNING_FOR_PROJECT_MAX_BUCKET = 5.freeze + JOBS_RUNNING_FOR_PROJECT_MAX_BUCKET = 5 OPERATION_COUNTERS = [ :build_can_pick, diff --git a/lib/gitlab/database/background_migration/batched_migration.rb b/lib/gitlab/database/background_migration/batched_migration.rb index 0c9add9b355..f3e00da9fe2 100644 --- a/lib/gitlab/database/background_migration/batched_migration.rb +++ b/lib/gitlab/database/background_migration/batched_migration.rb @@ -5,7 +5,7 @@ module Gitlab module BackgroundMigration class BatchedMigration < ActiveRecord::Base # rubocop:disable Rails/ApplicationRecord JOB_CLASS_MODULE = 'Gitlab::BackgroundMigration' - BATCH_CLASS_MODULE = "#{JOB_CLASS_MODULE}::BatchingStrategies".freeze + BATCH_CLASS_MODULE = "#{JOB_CLASS_MODULE}::BatchingStrategies" self.table_name = :batched_background_migrations diff --git a/lib/gitlab/database/similarity_score.rb b/lib/gitlab/database/similarity_score.rb index 40845c0d5e0..20bf6fa4d30 100644 --- a/lib/gitlab/database/similarity_score.rb +++ b/lib/gitlab/database/similarity_score.rb @@ -10,7 +10,7 @@ module Gitlab # Adds a "magic" comment in the generated SQL expression in order to be able to tell if we're sorting by similarity. # Example: /* gitlab/database/similarity_score */ SIMILARITY(COALESCE... - SIMILARITY_FUNCTION_CALL_WITH_ANNOTATION = "/* #{DISPLAY_NAME} */ SIMILARITY".freeze + SIMILARITY_FUNCTION_CALL_WITH_ANNOTATION = "/* #{DISPLAY_NAME} */ SIMILARITY" # This method returns an Arel expression that can be used in an ActiveRecord query to order the resultset by similarity. # diff --git a/lib/gitlab/exclusive_lease.rb b/lib/gitlab/exclusive_lease.rb index b602393b59e..ef0236f8275 100644 --- a/lib/gitlab/exclusive_lease.rb +++ b/lib/gitlab/exclusive_lease.rb @@ -15,14 +15,14 @@ module Gitlab PREFIX = 'gitlab:exclusive_lease' NoKey = Class.new(ArgumentError) - LUA_CANCEL_SCRIPT = <<~EOS.freeze + LUA_CANCEL_SCRIPT = <<~EOS local key, uuid = KEYS[1], ARGV[1] if redis.call("get", key) == uuid then redis.call("del", key) end EOS - LUA_RENEW_SCRIPT = <<~EOS.freeze + LUA_RENEW_SCRIPT = <<~EOS local key, uuid, ttl = KEYS[1], ARGV[1], ARGV[2] if redis.call("get", key) == uuid then redis.call("expire", key, ttl) diff --git a/lib/gitlab/gitaly_client/storage_settings.rb b/lib/gitlab/gitaly_client/storage_settings.rb index 7edd42f9ef7..dd9e3d5d28b 100644 --- a/lib/gitlab/gitaly_client/storage_settings.rb +++ b/lib/gitlab/gitaly_client/storage_settings.rb @@ -11,7 +11,7 @@ module Gitlab DirectPathAccessError = Class.new(StandardError) InvalidConfigurationError = Class.new(StandardError) - INVALID_STORAGE_MESSAGE = <<~MSG.freeze + INVALID_STORAGE_MESSAGE = <<~MSG Storage is invalid because it has no `path` key. For source installations, update your config/gitlab.yml Refer to gitlab.yml.example for an updated example. diff --git a/lib/gitlab/golang.rb b/lib/gitlab/golang.rb index 097967cbcf5..31b7a198b92 100644 --- a/lib/gitlab/golang.rb +++ b/lib/gitlab/golang.rb @@ -7,7 +7,7 @@ module Gitlab extend self def local_module_prefix - @gitlab_prefix ||= "#{Settings.build_gitlab_go_url}/".freeze + @gitlab_prefix ||= "#{Settings.build_gitlab_go_url}/" end def semver_tag?(tag) diff --git a/lib/gitlab/import_export/base/relation_factory.rb b/lib/gitlab/import_export/base/relation_factory.rb index d60bc79df4c..05a4a8f4c93 100644 --- a/lib/gitlab/import_export/base/relation_factory.rb +++ b/lib/gitlab/import_export/base/relation_factory.rb @@ -6,7 +6,7 @@ module Gitlab class RelationFactory include Gitlab::Utils::StrongMemoize - IMPORTED_OBJECT_MAX_RETRIES = 5.freeze + IMPORTED_OBJECT_MAX_RETRIES = 5 OVERRIDES = {}.freeze EXISTING_OBJECT_RELATIONS = %i[].freeze diff --git a/lib/gitlab/middleware/multipart.rb b/lib/gitlab/middleware/multipart.rb index 79f1abe820f..329041e3ba2 100644 --- a/lib/gitlab/middleware/multipart.rb +++ b/lib/gitlab/middleware/multipart.rb @@ -31,7 +31,7 @@ module Gitlab RACK_ENV_KEY = 'HTTP_GITLAB_WORKHORSE_MULTIPART_FIELDS' JWT_PARAM_SUFFIX = '.gitlab-workhorse-upload' JWT_PARAM_FIXED_KEY = 'upload' - REWRITTEN_FIELD_NAME_MAX_LENGTH = 10000.freeze + REWRITTEN_FIELD_NAME_MAX_LENGTH = 10000 class Handler def initialize(env, message) diff --git a/lib/gitlab/middleware/same_site_cookies.rb b/lib/gitlab/middleware/same_site_cookies.rb index 37ccc5abb10..405732e8015 100644 --- a/lib/gitlab/middleware/same_site_cookies.rb +++ b/lib/gitlab/middleware/same_site_cookies.rb @@ -17,7 +17,7 @@ module Gitlab module Middleware class SameSiteCookies - COOKIE_SEPARATOR = "\n".freeze + COOKIE_SEPARATOR = "\n" def initialize(app) @app = app diff --git a/lib/gitlab/prometheus/queries/matched_metric_query.rb b/lib/gitlab/prometheus/queries/matched_metric_query.rb index e4d44df3baf..73de5a11998 100644 --- a/lib/gitlab/prometheus/queries/matched_metric_query.rb +++ b/lib/gitlab/prometheus/queries/matched_metric_query.rb @@ -4,7 +4,7 @@ module Gitlab module Prometheus module Queries class MatchedMetricQuery < BaseQuery - MAX_QUERY_ITEMS = 40.freeze + MAX_QUERY_ITEMS = 40 def query groups_data.map do |group, data| diff --git a/lib/gitlab/uuid.rb b/lib/gitlab/uuid.rb index 80caf2c6788..3344fad1d44 100644 --- a/lib/gitlab/uuid.rb +++ b/lib/gitlab/uuid.rb @@ -11,7 +11,7 @@ module Gitlab UUID_V5_PATTERN = /\h{8}-\h{4}-5\h{3}-\h{4}-\h{4}\h{8}/.freeze NAMESPACE_REGEX = /(\h{8})-(\h{4})-(\h{4})-(\h{4})-(\h{4})(\h{8})/.freeze - PACK_PATTERN = "NnnnnN".freeze + PACK_PATTERN = "NnnnnN" class << self def v5(name, namespace_id: default_namespace_id) diff --git a/lib/tasks/cache.rake b/lib/tasks/cache.rake index 4d698e56444..13365b9ec07 100644 --- a/lib/tasks/cache.rake +++ b/lib/tasks/cache.rake @@ -3,7 +3,7 @@ namespace :cache do namespace :clear do REDIS_CLEAR_BATCH_SIZE = 1000 # There seems to be no speedup when pushing beyond 1,000 - REDIS_SCAN_START_STOP = '0'.freeze # Magic value, see http://redis.io/commands/scan + REDIS_SCAN_START_STOP = '0' # Magic value, see http://redis.io/commands/scan desc "GitLab | Cache | Clear redis cache" task redis: :environment do diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 478c35c81e0..7697b631b25 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -6491,6 +6491,9 @@ msgstr "" msgid "ClusterAgents|Integrate with the GitLab Agent" msgstr "" +msgid "ClusterAgents|Last used" +msgstr "" + msgid "ClusterAgents|Learn how to create an agent access token" msgstr "" @@ -6500,6 +6503,9 @@ msgstr "" msgid "ClusterAgents|Name" msgstr "" +msgid "ClusterAgents|Never" +msgstr "" + msgid "ClusterAgents|The GitLab Agent also requires %{linkStart}enabling the Agent Server%{linkEnd}" msgstr "" diff --git a/rubocop/cop/avoid_keyword_arguments_in_sidekiq_workers.rb b/rubocop/cop/avoid_keyword_arguments_in_sidekiq_workers.rb index e1c6a984e75..da3cac073ad 100644 --- a/rubocop/cop/avoid_keyword_arguments_in_sidekiq_workers.rb +++ b/rubocop/cop/avoid_keyword_arguments_in_sidekiq_workers.rb @@ -5,7 +5,7 @@ module RuboCop # Cop that blacklists keyword arguments usage in Sidekiq workers class AvoidKeywordArgumentsInSidekiqWorkers < RuboCop::Cop::Cop MSG = "Do not use keyword arguments in Sidekiq workers. " \ - "For details, check https://github.com/mperham/sidekiq/issues/2372".freeze + "For details, check https://github.com/mperham/sidekiq/issues/2372" OBSERVED_METHOD = :perform def on_def(node) diff --git a/rubocop/cop/gitlab/change_timzone.rb b/rubocop/cop/gitlab/change_timzone.rb index 63e6dd411f3..c30a057d51c 100644 --- a/rubocop/cop/gitlab/change_timzone.rb +++ b/rubocop/cop/gitlab/change_timzone.rb @@ -5,7 +5,7 @@ module RuboCop module Gitlab class ChangeTimezone < RuboCop::Cop::Cop MSG = "Do not change timezone in the runtime (application or rspec), " \ - "it could result in silently modifying other behavior.".freeze + "it could result in silently modifying other behavior." def_node_matcher :changing_timezone?, <<~PATTERN (send (const nil? :Time) :zone= ...) diff --git a/rubocop/cop/qa/ambiguous_page_object_name.rb b/rubocop/cop/qa/ambiguous_page_object_name.rb index 5cd8ea25c87..a4a2c04f61f 100644 --- a/rubocop/cop/qa/ambiguous_page_object_name.rb +++ b/rubocop/cop/qa/ambiguous_page_object_name.rb @@ -19,7 +19,7 @@ module RuboCop class AmbiguousPageObjectName < RuboCop::Cop::Cop include QAHelpers - MESSAGE = "Don't use 'page' as a name for a Page Object. Use `%s` instead.".freeze + MESSAGE = "Don't use 'page' as a name for a Page Object. Use `%s` instead." def_node_matcher :ambiguous_page?, <<~PATTERN (block diff --git a/rubocop/cop/qa/element_with_pattern.rb b/rubocop/cop/qa/element_with_pattern.rb index d48f4725488..d0a42497960 100644 --- a/rubocop/cop/qa/element_with_pattern.rb +++ b/rubocop/cop/qa/element_with_pattern.rb @@ -19,7 +19,7 @@ module RuboCop class ElementWithPattern < RuboCop::Cop::Cop include QAHelpers - MESSAGE = "Don't use a pattern for element, create a corresponding `%s` instead.".freeze + MESSAGE = "Don't use a pattern for element, create a corresponding `%s` instead." def on_send(node) return unless in_qa_file?(node) diff --git a/rubocop/cop/rspec/env_assignment.rb b/rubocop/cop/rspec/env_assignment.rb index 73e108c2232..e3075e7bd90 100644 --- a/rubocop/cop/rspec/env_assignment.rb +++ b/rubocop/cop/rspec/env_assignment.rb @@ -17,7 +17,7 @@ module RuboCop # stub_env('FOO', 'bar') # end class EnvAssignment < RuboCop::Cop::Cop - MESSAGE = "Don't assign to ENV, use `stub_env` instead.".freeze + MESSAGE = "Don't assign to ENV, use `stub_env` instead." def_node_search :env_assignment?, <<~PATTERN (send (const nil? :ENV) :[]= ...) diff --git a/rubocop/cop/rspec/factories_in_migration_specs.rb b/rubocop/cop/rspec/factories_in_migration_specs.rb index 732e0d92bbd..f29bbf68cdc 100644 --- a/rubocop/cop/rspec/factories_in_migration_specs.rb +++ b/rubocop/cop/rspec/factories_in_migration_specs.rb @@ -14,7 +14,7 @@ module RuboCop # let(:users) { table(:users) } # let(:user) { users.create!(name: 'User 1', username: 'user1') } class FactoriesInMigrationSpecs < RuboCop::Cop::Cop - MESSAGE = "Don't use FactoryBot.%s in migration specs, use `table` instead.".freeze + MESSAGE = "Don't use FactoryBot.%s in migration specs, use `table` instead." FORBIDDEN_METHODS = %i[build build_list create create_list attributes_for].freeze def_node_search :forbidden_factory_usage?, <<~PATTERN diff --git a/rubocop/cop/rspec/httparty_basic_auth.rb b/rubocop/cop/rspec/httparty_basic_auth.rb index 529a5808662..c6b52ac9781 100644 --- a/rubocop/cop/rspec/httparty_basic_auth.rb +++ b/rubocop/cop/rspec/httparty_basic_auth.rb @@ -13,7 +13,7 @@ module RuboCop # # good # HTTParty.get(url, basic_auth: { username: 'foo' }) class HTTPartyBasicAuth < RuboCop::Cop::Cop - MESSAGE = "`basic_auth: { user: ... }` does not work - replace `user:` with `username:`".freeze + MESSAGE = "`basic_auth: { user: ... }` does not work - replace `user:` with `username:`" RESTRICT_ON_SEND = %i(get put post delete).freeze diff --git a/rubocop/cop/static_translation_definition.rb b/rubocop/cop/static_translation_definition.rb index 55956d9665b..ac50fd94884 100644 --- a/rubocop/cop/static_translation_definition.rb +++ b/rubocop/cop/static_translation_definition.rb @@ -3,7 +3,7 @@ module RuboCop module Cop class StaticTranslationDefinition < RuboCop::Cop::Cop - MSG = "The text you're translating will be already in the translated form when it's assigned to the constant. When a users changes the locale, these texts won't be translated again. Consider moving the translation logic to a method.".freeze + MSG = "The text you're translating will be already in the translated form when it's assigned to the constant. When a users changes the locale, these texts won't be translated again. Consider moving the translation logic to a method." TRANSLATION_METHODS = %i[_ s_ n_].freeze diff --git a/spec/features/milestones/user_creates_milestone_spec.rb b/spec/features/milestones/user_creates_milestone_spec.rb index d80796b8f9a..dd377aa4a26 100644 --- a/spec/features/milestones/user_creates_milestone_spec.rb +++ b/spec/features/milestones/user_creates_milestone_spec.rb @@ -14,7 +14,7 @@ RSpec.describe "User creates milestone", :js do end it "creates milestone" do - title = "v2.3".freeze + title = "v2.3" fill_in("Title", with: title) fill_in("Description", with: "# Description header") diff --git a/spec/features/projects/branches/user_creates_branch_spec.rb b/spec/features/projects/branches/user_creates_branch_spec.rb index 52c860bfe36..18d083f7d88 100644 --- a/spec/features/projects/branches/user_creates_branch_spec.rb +++ b/spec/features/projects/branches/user_creates_branch_spec.rb @@ -16,7 +16,7 @@ RSpec.describe "User creates branch", :js do end it "creates new branch" do - branch_name = "deploy_keys".freeze + branch_name = "deploy_keys" create_branch(branch_name) @@ -25,7 +25,7 @@ RSpec.describe "User creates branch", :js do context "when branch name is invalid" do it "does not create new branch" do - invalid_branch_name = "1.0 stable".freeze + invalid_branch_name = "1.0 stable" fill_in("branch_name", with: invalid_branch_name) page.find("body").click # defocus the branch_name input diff --git a/spec/features/projects/commit/comments/user_edits_comments_spec.rb b/spec/features/projects/commit/comments/user_edits_comments_spec.rb index 787d8cdb02b..8ac15c9cb7f 100644 --- a/spec/features/projects/commit/comments/user_edits_comments_spec.rb +++ b/spec/features/projects/commit/comments/user_edits_comments_spec.rb @@ -19,7 +19,7 @@ RSpec.describe "User edits a comment on a commit", :js do end it "edits comment" do - new_comment_text = "+1 Awesome!".freeze + new_comment_text = "+1 Awesome!" page.within(".main-notes-list") do note = find(".note") diff --git a/spec/frontend/__helpers__/test_constants.js b/spec/frontend/__helpers__/test_constants.js index 69b78f556aa..628b9b054d3 100644 --- a/spec/frontend/__helpers__/test_constants.js +++ b/spec/frontend/__helpers__/test_constants.js @@ -6,6 +6,8 @@ const DUMMY_IMAGE_URL = `${FIXTURES_PATH}/static/images/one_white_pixel.png`; const GREEN_BOX_IMAGE_URL = `${FIXTURES_PATH}/static/images/green_box.png`; const RED_BOX_IMAGE_URL = `${FIXTURES_PATH}/static/images/red_box.png`; +const DUMMY_IMAGE_BLOB_PATH = 'SpongeBlob.png'; + // NOTE: module.exports is needed so that this file can be used // by environment.js // @@ -16,4 +18,5 @@ module.exports = { DUMMY_IMAGE_URL, GREEN_BOX_IMAGE_URL, RED_BOX_IMAGE_URL, + DUMMY_IMAGE_BLOB_PATH, }; diff --git a/spec/frontend/vue_shared/components/content_viewer/viewers/image_viewer_spec.js b/spec/frontend/vue_shared/components/content_viewer/viewers/image_viewer_spec.js index af3b63ad7e5..974d06a6ed4 100644 --- a/spec/frontend/vue_shared/components/content_viewer/viewers/image_viewer_spec.js +++ b/spec/frontend/vue_shared/components/content_viewer/viewers/image_viewer_spec.js @@ -1,12 +1,12 @@ -import { mount } from '@vue/test-utils'; -import { GREEN_BOX_IMAGE_URL } from 'spec/test_constants'; +import { shallowMount } from '@vue/test-utils'; +import { GREEN_BOX_IMAGE_URL, DUMMY_IMAGE_BLOB_PATH } from 'spec/test_constants'; import ImageViewer from '~/vue_shared/components/content_viewer/viewers/image_viewer.vue'; describe('Image Viewer', () => { let wrapper; it('renders image preview', () => { - wrapper = mount(ImageViewer, { + wrapper = shallowMount(ImageViewer, { propsData: { path: GREEN_BOX_IMAGE_URL, fileSize: 1024 }, }); @@ -22,7 +22,7 @@ describe('Image Viewer', () => { `( 'shows file size as "$humanizedFileSize", if fileSize=$fileSize and renderInfo=$renderInfo', ({ fileSize, renderInfo, elementExists, humanizedFileSize }) => { - wrapper = mount(ImageViewer, { + wrapper = shallowMount(ImageViewer, { propsData: { path: GREEN_BOX_IMAGE_URL, fileSize, renderInfo }, }); @@ -36,11 +36,19 @@ describe('Image Viewer', () => { describe('file path', () => { it('should output a valid URL path for the image', () => { - wrapper = mount(ImageViewer, { + wrapper = shallowMount(ImageViewer, { propsData: { path: '/url/hello#1.jpg' }, }); expect(wrapper.find('img').attributes('src')).toBe('/url/hello%231.jpg'); }); + it('outputs path without transformations when outputting a Blob', () => { + const file = new File([], DUMMY_IMAGE_BLOB_PATH); + const path = window.URL.createObjectURL(file); + wrapper = shallowMount(ImageViewer, { + propsData: { path }, + }); + expect(wrapper.find('img').attributes('src')).toBe(path); + }); }); }); diff --git a/spec/lib/gitlab/utils_spec.rb b/spec/lib/gitlab/utils_spec.rb index 665eebdfd9e..2f6900e5118 100644 --- a/spec/lib/gitlab/utils_spec.rb +++ b/spec/lib/gitlab/utils_spec.rb @@ -162,7 +162,7 @@ RSpec.describe Gitlab::Utils do describe '.nlbr' do it 'replaces new lines with
' do - expect(described_class.nlbr("hello\nworld".freeze)).to eq("hello
world") + expect(described_class.nlbr("hello\nworld")).to eq("hello
world") end end @@ -388,8 +388,8 @@ RSpec.describe Gitlab::Utils do describe ".safe_downcase!" do where(:str, :result) do - "test".freeze | "test" - "Test".freeze | "test" + "test" | "test" + "Test" | "test" "test" | "test" "Test" | "test" end diff --git a/spec/rubocop/cop/rspec/env_assignment_spec.rb b/spec/rubocop/cop/rspec/env_assignment_spec.rb index da6bb2fa2fb..0fd09eeae11 100644 --- a/spec/rubocop/cop/rspec/env_assignment_spec.rb +++ b/spec/rubocop/cop/rspec/env_assignment_spec.rb @@ -5,8 +5,8 @@ require 'fast_spec_helper' require_relative '../../../../rubocop/cop/rspec/env_assignment' RSpec.describe RuboCop::Cop::RSpec::EnvAssignment do - offense_call_single_quotes_key = %(ENV['FOO'] = 'bar').freeze - offense_call_double_quotes_key = %(ENV["FOO"] = 'bar').freeze + offense_call_single_quotes_key = %(ENV['FOO'] = 'bar') + offense_call_double_quotes_key = %(ENV["FOO"] = 'bar') let(:source_file) { 'spec/foo_spec.rb' } diff --git a/spec/services/packages/create_dependency_service_spec.rb b/spec/services/packages/create_dependency_service_spec.rb index 3ad59b31b2c..3eae9f099f7 100644 --- a/spec/services/packages/create_dependency_service_spec.rb +++ b/spec/services/packages/create_dependency_service_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Packages::CreateDependencyService do describe '#execute' do let_it_be(:namespace) {create(:namespace)} let_it_be(:version) { '1.0.1' } - let_it_be(:package_name) { "@#{namespace.path}/my-app".freeze } + let_it_be(:package_name) { "@#{namespace.path}/my-app" } context 'when packages are published' do let(:json_file) { 'packages/npm/payload.json' } diff --git a/spec/support/helpers/ci_artifact_metadata_generator.rb b/spec/support/helpers/ci_artifact_metadata_generator.rb index e02501565a9..ae821d6582b 100644 --- a/spec/support/helpers/ci_artifact_metadata_generator.rb +++ b/spec/support/helpers/ci_artifact_metadata_generator.rb @@ -7,7 +7,7 @@ class CiArtifactMetadataGenerator attr_accessor :entries, :output - ARTIFACT_METADATA = "GitLab Build Artifacts Metadata 0.0.2\n".freeze + ARTIFACT_METADATA = "GitLab Build Artifacts Metadata 0.0.2\n" def initialize(stream) @entries = {} diff --git a/spec/support/helpers/jira_service_helper.rb b/spec/support/helpers/jira_service_helper.rb index 698490c8c92..ce908d53f88 100644 --- a/spec/support/helpers/jira_service_helper.rb +++ b/spec/support/helpers/jira_service_helper.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module JiraServiceHelper - JIRA_URL = "http://jira.example.net".freeze + JIRA_URL = "http://jira.example.net" JIRA_API = JIRA_URL + "/rest/api/2" def jira_service_settings diff --git a/spec/support/helpers/seed_repo.rb b/spec/support/helpers/seed_repo.rb index 20738b45129..74ac529a3de 100644 --- a/spec/support/helpers/seed_repo.rb +++ b/spec/support/helpers/seed_repo.rb @@ -31,64 +31,64 @@ module SeedRepo module BigCommit - ID = "913c66a37b4a45b9769037c55c2d238bd0942d2e".freeze - PARENT_ID = "cfe32cf61b73a0d5e9f13e774abde7ff789b1660".freeze - MESSAGE = "Files, encoding and much more".freeze - AUTHOR_FULL_NAME = "Dmitriy Zaporozhets".freeze + ID = "913c66a37b4a45b9769037c55c2d238bd0942d2e" + PARENT_ID = "cfe32cf61b73a0d5e9f13e774abde7ff789b1660" + MESSAGE = "Files, encoding and much more" + AUTHOR_FULL_NAME = "Dmitriy Zaporozhets" FILES_COUNT = 2 end module Commit - ID = "570e7b2abdd848b95f2f578043fc23bd6f6fd24d".freeze - PARENT_ID = "6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9".freeze - MESSAGE = "Change some files\n\nSigned-off-by: Dmitriy Zaporozhets \n".freeze - AUTHOR_FULL_NAME = "Dmitriy Zaporozhets".freeze + ID = "570e7b2abdd848b95f2f578043fc23bd6f6fd24d" + PARENT_ID = "6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9" + MESSAGE = "Change some files\n\nSigned-off-by: Dmitriy Zaporozhets \n" + AUTHOR_FULL_NAME = "Dmitriy Zaporozhets" FILES = ["files/ruby/popen.rb", "files/ruby/regex.rb"].freeze FILES_COUNT = 2 - C_FILE_PATH = "files/ruby".freeze + C_FILE_PATH = "files/ruby" C_FILES = ["popen.rb", "regex.rb", "version_info.rb"].freeze - BLOB_FILE = %{%h3= @key.title\n%hr\n%pre= @key.key\n.actions\n = link_to 'Remove', @key, :confirm => 'Are you sure?', :method => :delete, :class => \"btn danger delete-key\"\n\n\n}.freeze - BLOB_FILE_PATH = "app/views/keys/show.html.haml".freeze + BLOB_FILE = %{%h3= @key.title\n%hr\n%pre= @key.key\n.actions\n = link_to 'Remove', @key, :confirm => 'Are you sure?', :method => :delete, :class => \"btn danger delete-key\"\n\n\n} + BLOB_FILE_PATH = "app/views/keys/show.html.haml" end module EmptyCommit - ID = "b0e52af38d7ea43cf41d8a6f2471351ac036d6c9".freeze - PARENT_ID = "40f4a7a617393735a95a0bb67b08385bc1e7c66d".freeze - MESSAGE = "Empty commit".freeze - AUTHOR_FULL_NAME = "Rémy Coutable".freeze + ID = "b0e52af38d7ea43cf41d8a6f2471351ac036d6c9" + PARENT_ID = "40f4a7a617393735a95a0bb67b08385bc1e7c66d" + MESSAGE = "Empty commit" + AUTHOR_FULL_NAME = "Rémy Coutable" FILES = [].freeze FILES_COUNT = FILES.count end module EncodingCommit - ID = "40f4a7a617393735a95a0bb67b08385bc1e7c66d".freeze - PARENT_ID = "66028349a123e695b589e09a36634d976edcc5e8".freeze - MESSAGE = "Add ISO-8859-encoded file".freeze - AUTHOR_FULL_NAME = "Stan Hu".freeze + ID = "40f4a7a617393735a95a0bb67b08385bc1e7c66d" + PARENT_ID = "66028349a123e695b589e09a36634d976edcc5e8" + MESSAGE = "Add ISO-8859-encoded file" + AUTHOR_FULL_NAME = "Stan Hu" FILES = ["encoding/iso8859.txt"].freeze FILES_COUNT = FILES.count end module FirstCommit - ID = "1a0b36b3cdad1d2ee32457c102a8c0b7056fa863".freeze + ID = "1a0b36b3cdad1d2ee32457c102a8c0b7056fa863" PARENT_ID = nil - MESSAGE = "Initial commit".freeze - AUTHOR_FULL_NAME = "Dmitriy Zaporozhets".freeze + MESSAGE = "Initial commit" + AUTHOR_FULL_NAME = "Dmitriy Zaporozhets" FILES = ["LICENSE", ".gitignore", "README.md"].freeze FILES_COUNT = 3 end module LastCommit - ID = "4b4918a572fa86f9771e5ba40fbd48e1eb03e2c6".freeze - PARENT_ID = "0e1b353b348f8477bdbec1ef47087171c5032cd9".freeze - MESSAGE = "Merge branch 'master' into 'master'".freeze - AUTHOR_FULL_NAME = "Stan Hu".freeze + ID = "4b4918a572fa86f9771e5ba40fbd48e1eb03e2c6" + PARENT_ID = "0e1b353b348f8477bdbec1ef47087171c5032cd9" + MESSAGE = "Merge branch 'master' into 'master'" + AUTHOR_FULL_NAME = "Stan Hu" FILES = ["bin/executable"].freeze FILES_COUNT = FILES.count end module Repo - HEAD = "master".freeze + HEAD = "master" BRANCHES = %w[ feature fix @@ -111,9 +111,9 @@ module SeedRepo end module RubyBlob - ID = "7e3e39ebb9b2bf433b4ad17313770fbe4051649c".freeze - NAME = "popen.rb".freeze - CONTENT = <<-eos.freeze + ID = "7e3e39ebb9b2bf433b4ad17313770fbe4051649c" + NAME = "popen.rb" + CONTENT = <<-eos require 'fileutils' require 'open3'