Commit f293f4db authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch '31343-remove-remaining-unnecessary-use-of-freeze' into 'master'

Enable RedundantFreeze Cop [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!57288
parents 299fc1e4 5f30cbe6
......@@ -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:
......
......@@ -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}"
......
......@@ -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}
......
......@@ -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)
......
......@@ -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
......
......@@ -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 }
......
......@@ -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) }
......
......@@ -6,7 +6,7 @@ module Packages
include Packages::Nuget::PresenterHelpers
include Gitlab::Utils::StrongMemoize
COUNT = 1.freeze
COUNT = 1
def initialize(packages)
@packages = packages
......
......@@ -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
......
......@@ -2,7 +2,7 @@
module MergeRequests
class MigrateExternalDiffsService < ::BaseService
MAX_JOBS = 1000.freeze
MAX_JOBS = 1000
attr_reader :diff
......
......@@ -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)
......
......@@ -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
......
......@@ -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
......
---
title: Enable RedundantFreeze Cop and Remove Remaining Offenses
merge_request: 57288
author: Lee Tickett @leetickett
type: other
......@@ -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 %<labels>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.
......
......@@ -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!
......
......@@ -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
......
......@@ -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
......
......@@ -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!
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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!
......
......@@ -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!
......
......@@ -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!
......
......@@ -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!
......
......@@ -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!
......
......@@ -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!
......
......@@ -5,7 +5,7 @@
class Analytics::IssuesAnalytics
attr_reader :issues, :start_date, :months_back
DATE_FORMAT = "%Y-%m".freeze
DATE_FORMAT = "%Y-%m"
def initialize(issues:, months_back: nil)
@issues = issues
......
......@@ -9,7 +9,7 @@ module EE
extend ActiveSupport::Concern
extend ::Gitlab::Utils::Override
MIRROR_REMOTE = "upstream".freeze
MIRROR_REMOTE = "upstream"
prepended do
include Elastic::RepositoriesSearch
......
......@@ -13,7 +13,7 @@ class IssuablesAnalytics
attr_reader :issuables, :start_date, :end_date, :months_back
DATE_FORMAT = "%Y-%m".freeze
DATE_FORMAT = "%Y-%m"
def initialize(issuables:, months_back: nil)
@issuables = issuables
......
......@@ -8,7 +8,7 @@ class License < ApplicationRecord
PREMIUM_PLAN = 'premium'
ULTIMATE_PLAN = 'ultimate'
CLOUD_LICENSE_TYPE = 'cloud'
ALLOWED_PERCENTAGE_OF_USERS_OVERAGE = (10 / 100.0).freeze
ALLOWED_PERCENTAGE_OF_USERS_OVERAGE = (10 / 100.0)
EE_ALL_PLANS = [STARTER_PLAN, PREMIUM_PLAN, ULTIMATE_PLAN].freeze
......
......@@ -19,7 +19,7 @@ module Ci
end
end
BATCH_SIZE = 1000.freeze
BATCH_SIZE = 1000
def initialize
@failed_batches = []
......
# frozen_string_literal: true
module GitlabSubscriptions
class FetchSubscriptionPlansService
URL = "#{EE::SUBSCRIPTIONS_URL}/gitlab_plans".freeze
URL = "#{EE::SUBSCRIPTIONS_URL}/gitlab_plans"
def initialize(plan:, namespace_id: nil)
@plan = plan
......
......@@ -13,9 +13,9 @@ module MergeTrains
include ::Gitlab::ExclusiveLeaseHelpers
include ::Gitlab::Utils::StrongMemoize
DEFAULT_CONCURRENCY = 20.freeze
DEFAULT_CONCURRENCY = 20
TRAIN_PROCESSING_LOCK_TIMEOUT = 15.minutes.freeze
SIGNAL_FOR_REFRESH_REQUEST = 1.freeze
SIGNAL_FOR_REFRESH_REQUEST = 1
def execute(target_project_id, target_branch)
@target_project_id = target_project_id
......
......@@ -5,8 +5,8 @@ module EE
module Checks
module PushRules
class BranchCheck < ::Gitlab::Checks::BaseChecker
ERROR_MESSAGE = "Branch name does not follow the pattern '%{branch_name_regex}'".freeze
LOG_MESSAGE = "Checking if branch follows the naming patterns defined by the project...".freeze
ERROR_MESSAGE = "Branch name does not follow the pattern '%{branch_name_regex}'"
LOG_MESSAGE = "Checking if branch follows the naming patterns defined by the project..."
def validate!
return unless push_rule
......
......@@ -10,7 +10,7 @@ module EE
committer_not_allowed: "You cannot push commits for '%{committer_email}'. You can only push commits that were committed with one of your own verified emails."
}.freeze
LOG_MESSAGE = "Checking if commits follow defined push rules...".freeze
LOG_MESSAGE = "Checking if commits follow defined push rules..."
def validate!
return unless push_rule
......
......@@ -5,7 +5,7 @@ module EE
module Checks
module PushRules
class FileSizeCheck < ::Gitlab::Checks::BaseChecker
LOG_MESSAGE = "Checking if any files are larger than the allowed size...".freeze
LOG_MESSAGE = "Checking if any files are larger than the allowed size..."
def validate!
return if push_rule.nil? || push_rule.max_file_size == 0
......
......@@ -7,7 +7,7 @@ module Gitlab
class DependencyScanning < Common
include Security::Concerns::DeprecatedSyntax
DEPRECATED_REPORT_VERSION = "1.3".freeze
DEPRECATED_REPORT_VERSION = "1.3"
private
......
......@@ -7,7 +7,7 @@ module Gitlab
class Sast < Common
include Security::Concerns::DeprecatedSyntax
DEPRECATED_REPORT_VERSION = "1.2".freeze
DEPRECATED_REPORT_VERSION = "1.2"
private
......
......@@ -7,7 +7,7 @@ module Gitlab
class SecretDetection < Common
include Security::Concerns::DeprecatedSyntax
DEPRECATED_REPORT_VERSION = "1.2".freeze
DEPRECATED_REPORT_VERSION = "1.2"
private
......
......@@ -4,8 +4,8 @@ module Gitlab
module Prometheus
module Queries
class PacketFlowQuery < BaseQuery
FORWARDED = "FORWARDED".freeze
DROPPED = "DROPPED".freeze
FORWARDED = "FORWARDED"
DROPPED = "DROPPED"
def query(namespace, interval = "hour", from = 1.day.ago.to_s, to = Time.now.to_s)
from = Time.parse(from)
......
......@@ -3,7 +3,7 @@
task spec: ['geo:db:test:prepare']
namespace :geo do
GEO_LICENSE_ERROR_TEXT = 'GitLab Geo is not supported with this license. Please contact the sales team: https://about.gitlab.com/sales.'.freeze
GEO_LICENSE_ERROR_TEXT = 'GitLab Geo is not supported with this license. Please contact the sales team: https://about.gitlab.com/sales.'
namespace :db do |ns|
desc 'GitLab | Geo | DB | Drops the Geo tracking database from config/database_geo.yml for the current RAILS_ENV.'
......
......@@ -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 = {
"'" => "'",
......
......@@ -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|
......
......@@ -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)
......
......@@ -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
......
......@@ -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 || {}
......
......@@ -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)
......
......@@ -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,
......
......@@ -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
......
......@@ -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.
#
......
......@@ -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)
......
......@@ -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.
......
......@@ -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)
......
......@@ -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
......
......@@ -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)
......
......@@ -17,7 +17,7 @@
module Gitlab
module Middleware
class SameSiteCookies
COOKIE_SEPARATOR = "\n".freeze
COOKIE_SEPARATOR = "\n"
def initialize(app)
@app = app
......
......@@ -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|
......
......@@ -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)
......
......@@ -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
......
......@@ -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)
......
......@@ -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= ...)
......
......@@ -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
......
......@@ -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)
......
......@@ -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) :[]= ...)
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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")
......
......@@ -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
......
......@@ -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")
......
......@@ -162,7 +162,7 @@ RSpec.describe Gitlab::Utils do
describe '.nlbr' do
it 'replaces new lines with <br>' do
expect(described_class.nlbr("<b>hello</b>\n<i>world</i>".freeze)).to eq("hello<br>world")
expect(described_class.nlbr("<b>hello</b>\n<i>world</i>")).to eq("hello<br>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
......
......@@ -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' }
......
......@@ -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' }
......
......@@ -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 = {}
......
# 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
......
......@@ -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 <dmitriy.zaporozhets@gmail.com>\n".freeze
AUTHOR_FULL_NAME = "Dmitriy Zaporozhets".freeze
ID = "570e7b2abdd848b95f2f578043fc23bd6f6fd24d"
PARENT_ID = "6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9"
MESSAGE = "Change some files\n\nSigned-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>\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'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment