Commit 5f30cbe6 authored by Lee Tickett's avatar Lee Tickett

Enable RedundantFreeze Cop

parent 084591f6
...@@ -898,11 +898,6 @@ Style/RedundantFetchBlock: ...@@ -898,11 +898,6 @@ Style/RedundantFetchBlock:
Style/RedundantFileExtensionInRequire: Style/RedundantFileExtensionInRequire:
Enabled: false Enabled: false
# Offense count: 248
# Cop supports --auto-correct.
Style/RedundantFreeze:
Enabled: false
# Offense count: 206 # Offense count: 206
# Cop supports --auto-correct. # Cop supports --auto-correct.
Style/RedundantInterpolation: Style/RedundantInterpolation:
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module Mutations module Mutations
module ContainerRepositories module ContainerRepositories
class DestroyTags < ::Mutations::ContainerRepositories::DestroyBase class DestroyTags < ::Mutations::ContainerRepositories::DestroyBase
LIMIT = 20.freeze LIMIT = 20
TOO_MANY_TAGS_ERROR_MESSAGE = "Number of tags is greater than #{LIMIT}" TOO_MANY_TAGS_ERROR_MESSAGE = "Number of tags is greater than #{LIMIT}"
......
...@@ -4,7 +4,7 @@ module Ci ...@@ -4,7 +4,7 @@ module Ci
module BuildTraceChunks module BuildTraceChunks
class Redis class Redis
CHUNK_REDIS_TTL = 1.week 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 key, new_data, offset = KEYS[1], ARGV[1], ARGV[2]
local length = new_data:len() local length = new_data:len()
local expire = #{CHUNK_REDIS_TTL.seconds} local expire = #{CHUNK_REDIS_TTL.seconds}
......
...@@ -33,7 +33,7 @@ module CounterAttribute ...@@ -33,7 +33,7 @@ module CounterAttribute
extend AfterCommitQueue extend AfterCommitQueue
include Gitlab::ExclusiveLeaseHelpers 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_key, flushed_key = KEYS[1], KEYS[2]
local increment_value = redis.call("get", increment_key) or 0 local increment_value = redis.call("get", increment_key) or 0
local flushed_value = redis.call("incrby", flushed_key, increment_value) local flushed_value = redis.call("incrby", flushed_key, increment_value)
......
...@@ -8,7 +8,7 @@ module DesignManagement ...@@ -8,7 +8,7 @@ module DesignManagement
# repository is entirely GitLab-managed rather than user-facing. # repository is entirely GitLab-managed rather than user-facing.
# #
# Enable all uploaded files to be stored in LFS. # 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 /#{DesignManagement.designs_directory}/* filter=lfs diff=lfs merge=lfs -text
GA GA
......
...@@ -7,8 +7,8 @@ class Packages::Dependency < ApplicationRecord ...@@ -7,8 +7,8 @@ class Packages::Dependency < ApplicationRecord
validates :name, uniqueness: { scope: :version_pattern } validates :name, uniqueness: { scope: :version_pattern }
NAME_VERSION_PATTERN_TUPLE_MATCHING = '(name, version_pattern) = (?, ?)' NAME_VERSION_PATTERN_TUPLE_MATCHING = '(name, version_pattern) = (?, ?)'
MAX_STRING_LENGTH = 255.freeze MAX_STRING_LENGTH = 255
MAX_CHUNKED_QUERIES_COUNT = 10.freeze 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) 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 } 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 ...@@ -4,7 +4,7 @@ class Packages::Tag < ApplicationRecord
validates :package, :name, presence: true 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 NUGET_TAGS_SEPARATOR = ' ' # https://docs.microsoft.com/en-us/nuget/reference/nuspec#tags
scope :preload_package, -> { preload(:package) } scope :preload_package, -> { preload(:package) }
......
...@@ -6,7 +6,7 @@ module Packages ...@@ -6,7 +6,7 @@ module Packages
include Packages::Nuget::PresenterHelpers include Packages::Nuget::PresenterHelpers
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
COUNT = 1.freeze COUNT = 1
def initialize(packages) def initialize(packages)
@packages = packages @packages = packages
......
...@@ -5,7 +5,7 @@ module Suggestible ...@@ -5,7 +5,7 @@ module Suggestible
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
# This translates into limiting suggestion changes to `suggestion:-100+100`. # This translates into limiting suggestion changes to `suggestion:-100+100`.
MAX_LINES_CONTEXT = 100.freeze MAX_LINES_CONTEXT = 100
def diff_lines def diff_lines
strong_memoize(:diff_lines) do strong_memoize(:diff_lines) do
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module MergeRequests module MergeRequests
class MigrateExternalDiffsService < ::BaseService class MigrateExternalDiffsService < ::BaseService
MAX_JOBS = 1000.freeze MAX_JOBS = 1000
attr_reader :diff attr_reader :diff
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module PodLogs module PodLogs
class KubernetesService < PodLogs::BaseService class KubernetesService < PodLogs::BaseService
LOGS_LIMIT = 500.freeze LOGS_LIMIT = 500
REPLACEMENT_CHAR = "\u{FFFD}" REPLACEMENT_CHAR = "\u{FFFD}"
EncodingHelperError = Class.new(StandardError) EncodingHelperError = Class.new(StandardError)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module Users module Users
class BatchStatusCleanerService class BatchStatusCleanerService
BATCH_SIZE = 100.freeze BATCH_SIZE = 100
# Cleanup BATCH_SIZE user_statuses records # Cleanup BATCH_SIZE user_statuses records
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
......
...@@ -9,7 +9,7 @@ class ContainerExpirationPolicyWorker # rubocop:disable Scalability/IdempotentWo ...@@ -9,7 +9,7 @@ class ContainerExpirationPolicyWorker # rubocop:disable Scalability/IdempotentWo
InvalidPolicyError = Class.new(StandardError) InvalidPolicyError = Class.new(StandardError)
BATCH_SIZE = 1000.freeze BATCH_SIZE = 1000
def perform def perform
throttling_enabled? ? perform_throttled : perform_unthrottled 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 = [ ...@@ -7,12 +7,12 @@ NO_SPECS_LABELS = [
'documentation', 'documentation',
'QA' 'QA'
].freeze ].freeze
NO_NEW_SPEC_MESSAGE = <<~MSG.freeze NO_NEW_SPEC_MESSAGE = <<~MSG
You've made some app changes, but didn't add any tests. You've made some app changes, but didn't add any tests.
That's OK as long as you're refactoring existing code, That's OK as long as you're refactoring existing code,
but please consider adding any of the %<labels>s labels. but please consider adding any of the %<labels>s labels.
MSG 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. 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. 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: ...@@ -24,7 +24,7 @@ Please make sure the spec files pass in AS-IF-FOSS mode either:
MSG 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 Do not add new controller specs. We are moving from controller specs to
request specs (and/or feature specs). Please add request specs under request specs (and/or feature specs). Please add request specs under
`/spec/requests` and/or `/ee/spec/requests` instead. `/spec/requests` and/or `/ee/spec/requests` instead.
......
...@@ -4,8 +4,8 @@ class RemoveTerraformStateVerificationIndexes < ActiveRecord::Migration[6.0] ...@@ -4,8 +4,8 @@ class RemoveTerraformStateVerificationIndexes < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
DOWNTIME = false DOWNTIME = false
CHECKSUM_INDEX_NAME = "terraform_states_verification_checksum_partial".freeze CHECKSUM_INDEX_NAME = "terraform_states_verification_checksum_partial"
FAILURE_INDEX_NAME = "terraform_states_verification_failure_partial".freeze FAILURE_INDEX_NAME = "terraform_states_verification_failure_partial"
disable_ddl_transaction! disable_ddl_transaction!
......
...@@ -4,10 +4,10 @@ class AddHasExternalWikiTrigger < ActiveRecord::Migration[6.0] ...@@ -4,10 +4,10 @@ class AddHasExternalWikiTrigger < ActiveRecord::Migration[6.0]
include Gitlab::Database::SchemaHelpers include Gitlab::Database::SchemaHelpers
DOWNTIME = false DOWNTIME = false
FUNCTION_NAME = 'set_has_external_wiki'.freeze FUNCTION_NAME = 'set_has_external_wiki'
TRIGGER_ON_INSERT_NAME = 'trigger_has_external_wiki_on_insert'.freeze TRIGGER_ON_INSERT_NAME = 'trigger_has_external_wiki_on_insert'
TRIGGER_ON_UPDATE_NAME = 'trigger_has_external_wiki_on_update'.freeze TRIGGER_ON_UPDATE_NAME = 'trigger_has_external_wiki_on_update'
TRIGGER_ON_DELETE_NAME = 'trigger_has_external_wiki_on_delete'.freeze TRIGGER_ON_DELETE_NAME = 'trigger_has_external_wiki_on_delete'
def up def up
create_trigger_function(FUNCTION_NAME, replace: true) do create_trigger_function(FUNCTION_NAME, replace: true) do
......
...@@ -7,7 +7,7 @@ class DropTemporaryIndexOnCiBuilds < ActiveRecord::Migration[6.0] ...@@ -7,7 +7,7 @@ class DropTemporaryIndexOnCiBuilds < ActiveRecord::Migration[6.0]
disable_ddl_transaction! disable_ddl_transaction!
INDEX = 'tmp_build_stage_position_index'.freeze INDEX = 'tmp_build_stage_position_index'
def up def up
remove_concurrent_index_by_name :ci_builds, INDEX remove_concurrent_index_by_name :ci_builds, INDEX
......
...@@ -19,8 +19,8 @@ class ScheduleSyncIssuablesStateId < ActiveRecord::Migration[5.0] ...@@ -19,8 +19,8 @@ class ScheduleSyncIssuablesStateId < ActiveRecord::Migration[5.0]
# #
BATCH_SIZE = 5000 BATCH_SIZE = 5000
DELAY_INTERVAL = 120.seconds.to_i DELAY_INTERVAL = 120.seconds.to_i
ISSUES_MIGRATION = 'SyncIssuesStateId'.freeze ISSUES_MIGRATION = 'SyncIssuesStateId'
MERGE_REQUESTS_MIGRATION = 'SyncMergeRequestsStateId'.freeze MERGE_REQUESTS_MIGRATION = 'SyncMergeRequestsStateId'
disable_ddl_transaction! disable_ddl_transaction!
......
...@@ -5,7 +5,7 @@ class ScheduleBackfillPushRulesIdInProjects < ActiveRecord::Migration[6.0] ...@@ -5,7 +5,7 @@ class ScheduleBackfillPushRulesIdInProjects < ActiveRecord::Migration[6.0]
disable_ddl_transaction! disable_ddl_transaction!
MIGRATION = 'BackfillPushRulesIdInProjects'.freeze MIGRATION = 'BackfillPushRulesIdInProjects'
BATCH_SIZE = 1_000 BATCH_SIZE = 1_000
class PushRules < ActiveRecord::Base class PushRules < ActiveRecord::Base
......
...@@ -7,7 +7,7 @@ class MigrateVulnerabilityDismissals < ActiveRecord::Migration[6.0] ...@@ -7,7 +7,7 @@ class MigrateVulnerabilityDismissals < ActiveRecord::Migration[6.0]
disable_ddl_transaction! disable_ddl_transaction!
MIGRATION = 'UpdateVulnerabilitiesToDismissed'.freeze MIGRATION = 'UpdateVulnerabilitiesToDismissed'
BATCH_SIZE = 500 BATCH_SIZE = 500
DELAY_INTERVAL = 2.minutes.to_i DELAY_INTERVAL = 2.minutes.to_i
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
class SetJobWaiterTtl < ActiveRecord::Migration[6.0] class SetJobWaiterTtl < ActiveRecord::Migration[6.0]
DOWNTIME = false DOWNTIME = false
SCRIPT = <<~LUA.freeze SCRIPT = <<~LUA
if redis.call("ttl", KEYS[1]) < 0 then if redis.call("ttl", KEYS[1]) < 0 then
redis.call("expire", KEYS[1], 21600) redis.call("expire", KEYS[1], 21600)
end end
......
...@@ -7,7 +7,7 @@ class ScheduleSyncBlockingIssuesCount < ActiveRecord::Migration[6.0] ...@@ -7,7 +7,7 @@ class ScheduleSyncBlockingIssuesCount < ActiveRecord::Migration[6.0]
BATCH_SIZE = 50 BATCH_SIZE = 50
DELAY_INTERVAL = 120.seconds.to_i DELAY_INTERVAL = 120.seconds.to_i
MIGRATION = 'SyncBlockingIssuesCount'.freeze MIGRATION = 'SyncBlockingIssuesCount'
disable_ddl_transaction! disable_ddl_transaction!
......
...@@ -5,7 +5,7 @@ class ScheduleBackfillingArtifactExpiryMigration < ActiveRecord::Migration[6.0] ...@@ -5,7 +5,7 @@ class ScheduleBackfillingArtifactExpiryMigration < ActiveRecord::Migration[6.0]
DOWNTIME = false DOWNTIME = false
SWITCH_DATE = Time.utc(2020, 6, 22).freeze 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}'" INDEX_CONDITION = "expire_at IS NULL AND created_at < '#{SWITCH_DATE}'"
disable_ddl_transaction! disable_ddl_transaction!
......
...@@ -4,7 +4,7 @@ class CleanupProjectsWithBadHasExternalWikiData < ActiveRecord::Migration[6.0] ...@@ -4,7 +4,7 @@ class CleanupProjectsWithBadHasExternalWikiData < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
DOWNTIME = false 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 BATCH_SIZE = 100
disable_ddl_transaction! disable_ddl_transaction!
......
...@@ -4,11 +4,11 @@ class ScheduleArtifactExpiryBackfill < ActiveRecord::Migration[6.0] ...@@ -4,11 +4,11 @@ class ScheduleArtifactExpiryBackfill < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
DOWNTIME = false DOWNTIME = false
MIGRATION = 'BackfillArtifactExpiryDate'.freeze MIGRATION = 'BackfillArtifactExpiryDate'
SWITCH_DATE = Date.new(2020, 06, 22).freeze 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}'" 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! disable_ddl_transaction!
......
...@@ -4,7 +4,7 @@ class CleanupProjectsWithBadHasExternalIssueTrackerData < ActiveRecord::Migratio ...@@ -4,7 +4,7 @@ class CleanupProjectsWithBadHasExternalIssueTrackerData < ActiveRecord::Migratio
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
DOWNTIME = false 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 BATCH_SIZE = 100
disable_ddl_transaction! disable_ddl_transaction!
......
...@@ -4,7 +4,7 @@ class RescheduleArtifactExpiryBackfill < ActiveRecord::Migration[6.0] ...@@ -4,7 +4,7 @@ class RescheduleArtifactExpiryBackfill < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
DOWNTIME = false DOWNTIME = false
MIGRATION = 'BackfillArtifactExpiryDate'.freeze MIGRATION = 'BackfillArtifactExpiryDate'
SWITCH_DATE = Date.new(2020, 06, 22).freeze SWITCH_DATE = Date.new(2020, 06, 22).freeze
disable_ddl_transaction! disable_ddl_transaction!
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
class Analytics::IssuesAnalytics class Analytics::IssuesAnalytics
attr_reader :issues, :start_date, :months_back attr_reader :issues, :start_date, :months_back
DATE_FORMAT = "%Y-%m".freeze DATE_FORMAT = "%Y-%m"
def initialize(issues:, months_back: nil) def initialize(issues:, months_back: nil)
@issues = issues @issues = issues
......
...@@ -9,7 +9,7 @@ module EE ...@@ -9,7 +9,7 @@ module EE
extend ActiveSupport::Concern extend ActiveSupport::Concern
extend ::Gitlab::Utils::Override extend ::Gitlab::Utils::Override
MIRROR_REMOTE = "upstream".freeze MIRROR_REMOTE = "upstream"
prepended do prepended do
include Elastic::RepositoriesSearch include Elastic::RepositoriesSearch
......
...@@ -13,7 +13,7 @@ class IssuablesAnalytics ...@@ -13,7 +13,7 @@ class IssuablesAnalytics
attr_reader :issuables, :start_date, :end_date, :months_back attr_reader :issuables, :start_date, :end_date, :months_back
DATE_FORMAT = "%Y-%m".freeze DATE_FORMAT = "%Y-%m"
def initialize(issuables:, months_back: nil) def initialize(issuables:, months_back: nil)
@issuables = issuables @issuables = issuables
......
...@@ -8,7 +8,7 @@ class License < ApplicationRecord ...@@ -8,7 +8,7 @@ class License < ApplicationRecord
PREMIUM_PLAN = 'premium' PREMIUM_PLAN = 'premium'
ULTIMATE_PLAN = 'ultimate' ULTIMATE_PLAN = 'ultimate'
CLOUD_LICENSE_TYPE = 'cloud' 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 EE_ALL_PLANS = [STARTER_PLAN, PREMIUM_PLAN, ULTIMATE_PLAN].freeze
......
...@@ -19,7 +19,7 @@ module Ci ...@@ -19,7 +19,7 @@ module Ci
end end
end end
BATCH_SIZE = 1000.freeze BATCH_SIZE = 1000
def initialize def initialize
@failed_batches = [] @failed_batches = []
......
# frozen_string_literal: true # frozen_string_literal: true
module GitlabSubscriptions module GitlabSubscriptions
class FetchSubscriptionPlansService class FetchSubscriptionPlansService
URL = "#{EE::SUBSCRIPTIONS_URL}/gitlab_plans".freeze URL = "#{EE::SUBSCRIPTIONS_URL}/gitlab_plans"
def initialize(plan:, namespace_id: nil) def initialize(plan:, namespace_id: nil)
@plan = plan @plan = plan
......
...@@ -13,9 +13,9 @@ module MergeTrains ...@@ -13,9 +13,9 @@ module MergeTrains
include ::Gitlab::ExclusiveLeaseHelpers include ::Gitlab::ExclusiveLeaseHelpers
include ::Gitlab::Utils::StrongMemoize include ::Gitlab::Utils::StrongMemoize
DEFAULT_CONCURRENCY = 20.freeze DEFAULT_CONCURRENCY = 20
TRAIN_PROCESSING_LOCK_TIMEOUT = 15.minutes.freeze 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) def execute(target_project_id, target_branch)
@target_project_id = target_project_id @target_project_id = target_project_id
......
...@@ -5,8 +5,8 @@ module EE ...@@ -5,8 +5,8 @@ module EE
module Checks module Checks
module PushRules module PushRules
class BranchCheck < ::Gitlab::Checks::BaseChecker class BranchCheck < ::Gitlab::Checks::BaseChecker
ERROR_MESSAGE = "Branch name does not follow the pattern '%{branch_name_regex}'".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...".freeze LOG_MESSAGE = "Checking if branch follows the naming patterns defined by the project..."
def validate! def validate!
return unless push_rule return unless push_rule
......
...@@ -10,7 +10,7 @@ module EE ...@@ -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." 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 }.freeze
LOG_MESSAGE = "Checking if commits follow defined push rules...".freeze LOG_MESSAGE = "Checking if commits follow defined push rules..."
def validate! def validate!
return unless push_rule return unless push_rule
......
...@@ -5,7 +5,7 @@ module EE ...@@ -5,7 +5,7 @@ module EE
module Checks module Checks
module PushRules module PushRules
class FileSizeCheck < ::Gitlab::Checks::BaseChecker 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! def validate!
return if push_rule.nil? || push_rule.max_file_size == 0 return if push_rule.nil? || push_rule.max_file_size == 0
......
...@@ -7,7 +7,7 @@ module Gitlab ...@@ -7,7 +7,7 @@ module Gitlab
class DependencyScanning < Common class DependencyScanning < Common
include Security::Concerns::DeprecatedSyntax include Security::Concerns::DeprecatedSyntax
DEPRECATED_REPORT_VERSION = "1.3".freeze DEPRECATED_REPORT_VERSION = "1.3"
private private
......
...@@ -7,7 +7,7 @@ module Gitlab ...@@ -7,7 +7,7 @@ module Gitlab
class Sast < Common class Sast < Common
include Security::Concerns::DeprecatedSyntax include Security::Concerns::DeprecatedSyntax
DEPRECATED_REPORT_VERSION = "1.2".freeze DEPRECATED_REPORT_VERSION = "1.2"
private private
......
...@@ -7,7 +7,7 @@ module Gitlab ...@@ -7,7 +7,7 @@ module Gitlab
class SecretDetection < Common class SecretDetection < Common
include Security::Concerns::DeprecatedSyntax include Security::Concerns::DeprecatedSyntax
DEPRECATED_REPORT_VERSION = "1.2".freeze DEPRECATED_REPORT_VERSION = "1.2"
private private
......
...@@ -4,8 +4,8 @@ module Gitlab ...@@ -4,8 +4,8 @@ module Gitlab
module Prometheus module Prometheus
module Queries module Queries
class PacketFlowQuery < BaseQuery class PacketFlowQuery < BaseQuery
FORWARDED = "FORWARDED".freeze FORWARDED = "FORWARDED"
DROPPED = "DROPPED".freeze DROPPED = "DROPPED"
def query(namespace, interval = "hour", from = 1.day.ago.to_s, to = Time.now.to_s) def query(namespace, interval = "hour", from = 1.day.ago.to_s, to = Time.now.to_s)
from = Time.parse(from) from = Time.parse(from)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
task spec: ['geo:db:test:prepare'] task spec: ['geo:db:test:prepare']
namespace :geo do 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| namespace :db do |ns|
desc 'GitLab | Geo | DB | Drops the Geo tracking database from config/database_geo.yml for the current RAILS_ENV.' 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 ...@@ -43,7 +43,7 @@ module Banzai
TEXT_QUERY = %Q(descendant-or-self::text()[ TEXT_QUERY = %Q(descendant-or-self::text()[
not(#{IGNORE_PARENTS.map { |p| "ancestor::#{p}" }.join(' or ')}) not(#{IGNORE_PARENTS.map { |p| "ancestor::#{p}" }.join(' or ')})
and contains(., '://') and contains(., '://')
]).freeze ])
PUNCTUATION_PAIRS = { PUNCTUATION_PAIRS = {
"'" => "'", "'" => "'",
......
...@@ -42,7 +42,7 @@ module Banzai ...@@ -42,7 +42,7 @@ module Banzai
TEXT_QUERY = %Q(descendant-or-self::text()[ TEXT_QUERY = %Q(descendant-or-self::text()[
not(#{IGNORE_PARENTS.map { |p| "ancestor::#{p}" }.join(' or ')}) not(#{IGNORE_PARENTS.map { |p| "ancestor::#{p}" }.join(' or ')})
and contains(., ']\(') and contains(., ']\(')
]).freeze ])
def call def call
doc.xpath(TEXT_QUERY).each do |node| doc.xpath(TEXT_QUERY).each do |node|
......
...@@ -4,8 +4,8 @@ module BulkImports ...@@ -4,8 +4,8 @@ module BulkImports
module Clients module Clients
class Http class Http
API_VERSION = 'v4' API_VERSION = 'v4'
DEFAULT_PAGE = 1.freeze DEFAULT_PAGE = 1
DEFAULT_PER_PAGE = 30.freeze DEFAULT_PER_PAGE = 30
ConnectionError = Class.new(StandardError) ConnectionError = Class.new(StandardError)
......
...@@ -5,7 +5,7 @@ module Gitlab ...@@ -5,7 +5,7 @@ module Gitlab
module Ldap module Ldap
class Adapter class Adapter
SEARCH_RETRY_FACTOR = [1, 1, 2, 3].freeze 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 attr_reader :provider, :ldap
......
...@@ -4,7 +4,7 @@ module Gitlab ...@@ -4,7 +4,7 @@ module Gitlab
module Auth module Auth
module Saml module Saml
class OriginValidator class OriginValidator
AUTH_REQUEST_SESSION_KEY = "last_authn_request_id".freeze AUTH_REQUEST_SESSION_KEY = "last_authn_request_id"
def initialize(session) def initialize(session)
@session = session || {} @session = session || {}
......
...@@ -32,7 +32,7 @@ class Gitlab::BackgroundMigration::RecalculateVulnerabilitiesOccurrencesUuid ...@@ -32,7 +32,7 @@ class Gitlab::BackgroundMigration::RecalculateVulnerabilitiesOccurrencesUuid
}.freeze }.freeze
NAMESPACE_REGEX = /(\h{8})-(\h{4})-(\h{4})-(\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"
def self.call(value) def self.call(value)
Digest::UUID.uuid_v5(namespace_id, value) Digest::UUID.uuid_v5(namespace_id, value)
......
...@@ -14,7 +14,7 @@ module Gitlab ...@@ -14,7 +14,7 @@ module Gitlab
METRICS_SHARD_TAG_PREFIX = 'metrics_shard::' METRICS_SHARD_TAG_PREFIX = 'metrics_shard::'
DEFAULT_METRICS_SHARD = 'default' DEFAULT_METRICS_SHARD = 'default'
JOBS_RUNNING_FOR_PROJECT_MAX_BUCKET = 5.freeze JOBS_RUNNING_FOR_PROJECT_MAX_BUCKET = 5
OPERATION_COUNTERS = [ OPERATION_COUNTERS = [
:build_can_pick, :build_can_pick,
......
...@@ -5,7 +5,7 @@ module Gitlab ...@@ -5,7 +5,7 @@ module Gitlab
module BackgroundMigration module BackgroundMigration
class BatchedMigration < ActiveRecord::Base # rubocop:disable Rails/ApplicationRecord class BatchedMigration < ActiveRecord::Base # rubocop:disable Rails/ApplicationRecord
JOB_CLASS_MODULE = 'Gitlab::BackgroundMigration' 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 self.table_name = :batched_background_migrations
......
...@@ -10,7 +10,7 @@ module Gitlab ...@@ -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. # 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... # 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. # 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 ...@@ -15,14 +15,14 @@ module Gitlab
PREFIX = 'gitlab:exclusive_lease' PREFIX = 'gitlab:exclusive_lease'
NoKey = Class.new(ArgumentError) NoKey = Class.new(ArgumentError)
LUA_CANCEL_SCRIPT = <<~EOS.freeze LUA_CANCEL_SCRIPT = <<~EOS
local key, uuid = KEYS[1], ARGV[1] local key, uuid = KEYS[1], ARGV[1]
if redis.call("get", key) == uuid then if redis.call("get", key) == uuid then
redis.call("del", key) redis.call("del", key)
end end
EOS EOS
LUA_RENEW_SCRIPT = <<~EOS.freeze LUA_RENEW_SCRIPT = <<~EOS
local key, uuid, ttl = KEYS[1], ARGV[1], ARGV[2] local key, uuid, ttl = KEYS[1], ARGV[1], ARGV[2]
if redis.call("get", key) == uuid then if redis.call("get", key) == uuid then
redis.call("expire", key, ttl) redis.call("expire", key, ttl)
......
...@@ -11,7 +11,7 @@ module Gitlab ...@@ -11,7 +11,7 @@ module Gitlab
DirectPathAccessError = Class.new(StandardError) DirectPathAccessError = Class.new(StandardError)
InvalidConfigurationError = 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. 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. For source installations, update your config/gitlab.yml Refer to gitlab.yml.example for an updated example.
......
...@@ -5,7 +5,7 @@ module Gitlab ...@@ -5,7 +5,7 @@ module Gitlab
extend self extend self
def local_module_prefix def local_module_prefix
@gitlab_prefix ||= "#{Settings.build_gitlab_go_url}/".freeze @gitlab_prefix ||= "#{Settings.build_gitlab_go_url}/"
end end
def semver_tag?(tag) def semver_tag?(tag)
......
...@@ -6,7 +6,7 @@ module Gitlab ...@@ -6,7 +6,7 @@ module Gitlab
class RelationFactory class RelationFactory
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
IMPORTED_OBJECT_MAX_RETRIES = 5.freeze IMPORTED_OBJECT_MAX_RETRIES = 5
OVERRIDES = {}.freeze OVERRIDES = {}.freeze
EXISTING_OBJECT_RELATIONS = %i[].freeze EXISTING_OBJECT_RELATIONS = %i[].freeze
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
module Gitlab module Gitlab
module Jira module Jira
module Dvcs module Dvcs
ENCODED_SLASH = '@'.freeze ENCODED_SLASH = '@'
SLASH = '/'.freeze SLASH = '/'
ENCODED_ROUTE_REGEX = /[a-zA-Z0-9_\-\.#{ENCODED_SLASH}]+/.freeze ENCODED_ROUTE_REGEX = /[a-zA-Z0-9_\-\.#{ENCODED_SLASH}]+/.freeze
def self.encode_slash(path) def self.encode_slash(path)
......
...@@ -5,7 +5,7 @@ module Gitlab ...@@ -5,7 +5,7 @@ module Gitlab
class Deployment class Deployment
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
STABLE_TRACK_VALUE = 'stable'.freeze STABLE_TRACK_VALUE = 'stable'
def initialize(attributes = {}, pods: []) def initialize(attributes = {}, pods: [])
@attributes = attributes @attributes = attributes
......
...@@ -31,7 +31,7 @@ module Gitlab ...@@ -31,7 +31,7 @@ module Gitlab
RACK_ENV_KEY = 'HTTP_GITLAB_WORKHORSE_MULTIPART_FIELDS' RACK_ENV_KEY = 'HTTP_GITLAB_WORKHORSE_MULTIPART_FIELDS'
JWT_PARAM_SUFFIX = '.gitlab-workhorse-upload' JWT_PARAM_SUFFIX = '.gitlab-workhorse-upload'
JWT_PARAM_FIXED_KEY = 'upload' JWT_PARAM_FIXED_KEY = 'upload'
REWRITTEN_FIELD_NAME_MAX_LENGTH = 10000.freeze REWRITTEN_FIELD_NAME_MAX_LENGTH = 10000
class Handler class Handler
def initialize(env, message) def initialize(env, message)
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
module Gitlab module Gitlab
module Middleware module Middleware
class SameSiteCookies class SameSiteCookies
COOKIE_SEPARATOR = "\n".freeze COOKIE_SEPARATOR = "\n"
def initialize(app) def initialize(app)
@app = app @app = app
......
...@@ -4,7 +4,7 @@ module Gitlab ...@@ -4,7 +4,7 @@ module Gitlab
module Prometheus module Prometheus
module Queries module Queries
class MatchedMetricQuery < BaseQuery class MatchedMetricQuery < BaseQuery
MAX_QUERY_ITEMS = 40.freeze MAX_QUERY_ITEMS = 40
def query def query
groups_data.map do |group, data| groups_data.map do |group, data|
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
module Gitlab module Gitlab
module Tracking module Tracking
class StandardContext class StandardContext
GITLAB_STANDARD_SCHEMA_URL = 'iglu:com.gitlab/gitlab_standard/jsonschema/1-0-3'.freeze GITLAB_STANDARD_SCHEMA_URL = 'iglu:com.gitlab/gitlab_standard/jsonschema/1-0-3'
GITLAB_RAILS_SOURCE = 'gitlab-rails'.freeze GITLAB_RAILS_SOURCE = 'gitlab-rails'
def initialize(namespace: nil, project: nil, user: nil, **data) def initialize(namespace: nil, project: nil, user: nil, **data)
@data = data @data = data
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module Gitlab::UsageDataCounters module Gitlab::UsageDataCounters
class CiTemplateUniqueCounter class CiTemplateUniqueCounter
REDIS_SLOT = 'ci_templates'.freeze REDIS_SLOT = 'ci_templates'
# NOTE: Events originating from implicit Auto DevOps pipelines get prefixed with `implicit_` # NOTE: Events originating from implicit Auto DevOps pipelines get prefixed with `implicit_`
TEMPLATE_TO_EVENT = { TEMPLATE_TO_EVENT = {
......
...@@ -11,7 +11,7 @@ module Gitlab ...@@ -11,7 +11,7 @@ module Gitlab
UUID_V5_PATTERN = /\h{8}-\h{4}-5\h{3}-\h{4}-\h{4}\h{8}/.freeze 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 NAMESPACE_REGEX = /(\h{8})-(\h{4})-(\h{4})-(\h{4})-(\h{4})(\h{8})/.freeze
PACK_PATTERN = "NnnnnN".freeze PACK_PATTERN = "NnnnnN"
class << self class << self
def v5(name, namespace_id: default_namespace_id) def v5(name, namespace_id: default_namespace_id)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
namespace :cache do namespace :cache do
namespace :clear do namespace :clear do
REDIS_CLEAR_BATCH_SIZE = 1000 # There seems to be no speedup when pushing beyond 1,000 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" desc "GitLab | Cache | Clear redis cache"
task redis: :environment do task redis: :environment do
......
...@@ -4,7 +4,7 @@ module QA ...@@ -4,7 +4,7 @@ module QA
module Runtime module Runtime
module API module API
class Request class Request
API_VERSION = 'v4'.freeze API_VERSION = 'v4'
def initialize(api_client, path, **query_string) def initialize(api_client, path, **query_string)
query_string[:private_token] ||= api_client.personal_access_token unless query_string[:oauth_access_token] query_string[:private_token] ||= api_client.personal_access_token unless query_string[:oauth_access_token]
......
...@@ -15,7 +15,7 @@ module Helpers ...@@ -15,7 +15,7 @@ module Helpers
private private
STUBBED_KEY = '__STUBBED__'.freeze STUBBED_KEY = '__STUBBED__'
def add_stubbed_value(key, value) def add_stubbed_value(key, value)
allow(ENV).to receive(:[]).with(key).and_return(value) allow(ENV).to receive(:[]).with(key).and_return(value)
......
...@@ -5,7 +5,7 @@ module RuboCop ...@@ -5,7 +5,7 @@ module RuboCop
# Cop that blacklists keyword arguments usage in Sidekiq workers # Cop that blacklists keyword arguments usage in Sidekiq workers
class AvoidKeywordArgumentsInSidekiqWorkers < RuboCop::Cop::Cop class AvoidKeywordArgumentsInSidekiqWorkers < RuboCop::Cop::Cop
MSG = "Do not use keyword arguments in Sidekiq workers. " \ 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 OBSERVED_METHOD = :perform
def on_def(node) def on_def(node)
......
...@@ -5,7 +5,7 @@ module RuboCop ...@@ -5,7 +5,7 @@ module RuboCop
module Gitlab module Gitlab
class ChangeTimezone < RuboCop::Cop::Cop class ChangeTimezone < RuboCop::Cop::Cop
MSG = "Do not change timezone in the runtime (application or rspec), " \ 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 def_node_matcher :changing_timezone?, <<~PATTERN
(send (const nil? :Time) :zone= ...) (send (const nil? :Time) :zone= ...)
......
...@@ -21,7 +21,7 @@ module RuboCop ...@@ -21,7 +21,7 @@ module RuboCop
# # OK # # OK
# Rails.logger.level # Rails.logger.level
MSG = 'Use a structured JSON logger instead of `Rails.logger`. ' \ MSG = 'Use a structured JSON logger instead of `Rails.logger`. ' \
'https://docs.gitlab.com/ee/development/logging.html'.freeze 'https://docs.gitlab.com/ee/development/logging.html'
# See supported log methods: # See supported log methods:
# https://ruby-doc.org/stdlib-2.6.6/libdoc/logger/rdoc/Logger.html # https://ruby-doc.org/stdlib-2.6.6/libdoc/logger/rdoc/Logger.html
......
...@@ -20,7 +20,7 @@ module RuboCop ...@@ -20,7 +20,7 @@ module RuboCop
module Graphql module Graphql
class JSONType < RuboCop::Cop::Cop class JSONType < RuboCop::Cop::Cop
MSG = 'Avoid using GraphQL::Types::JSON. See: ' \ MSG = 'Avoid using GraphQL::Types::JSON. See: ' \
'https://docs.gitlab.com/ee/development/api_graphql_styleguide.html#json'.freeze 'https://docs.gitlab.com/ee/development/api_graphql_styleguide.html#json'
def_node_matcher :has_json_type?, <<~PATTERN def_node_matcher :has_json_type?, <<~PATTERN
(send nil? {:field :argument} (send nil? {:field :argument}
......
...@@ -4,7 +4,7 @@ module RuboCop ...@@ -4,7 +4,7 @@ module RuboCop
module Cop module Cop
# Cop that makes sure workers include `ApplicationWorker`, not `Sidekiq::Worker`. # Cop that makes sure workers include `ApplicationWorker`, not `Sidekiq::Worker`.
class IncludeSidekiqWorker < RuboCop::Cop::Cop class IncludeSidekiqWorker < RuboCop::Cop::Cop
MSG = 'Include `ApplicationWorker`, not `Sidekiq::Worker`.'.freeze MSG = 'Include `ApplicationWorker`, not `Sidekiq::Worker`.'
def_node_matcher :includes_sidekiq_worker?, <<~PATTERN def_node_matcher :includes_sidekiq_worker?, <<~PATTERN
(send nil? :include (const (const nil? :Sidekiq) :Worker)) (send nil? :include (const (const nil? :Sidekiq) :Worker))
......
...@@ -10,7 +10,7 @@ module RuboCop ...@@ -10,7 +10,7 @@ module RuboCop
# 1. Downloading the complete set of deprecations/ files from a CI # 1. Downloading the complete set of deprecations/ files from a CI
# pipeline (see https://gitlab.com/gitlab-org/gitlab/-/merge_requests/47720) # pipeline (see https://gitlab.com/gitlab-org/gitlab/-/merge_requests/47720)
class LastKeywordArgument < Cop class LastKeywordArgument < Cop
MSG = 'Using the last argument as keyword parameters is deprecated'.freeze MSG = 'Using the last argument as keyword parameters is deprecated'
DEPRECATIONS_GLOB = File.expand_path('../../../deprecations/**/*.yml', __dir__) DEPRECATIONS_GLOB = File.expand_path('../../../deprecations/**/*.yml', __dir__)
KEYWORD_DEPRECATION_STR = 'maybe ** should be added to the call' KEYWORD_DEPRECATION_STR = 'maybe ** should be added to the call'
......
...@@ -8,7 +8,7 @@ module RuboCop ...@@ -8,7 +8,7 @@ module RuboCop
class AddColumnWithDefault < RuboCop::Cop::Cop class AddColumnWithDefault < RuboCop::Cop::Cop
include MigrationHelpers include MigrationHelpers
MSG = '`add_column_with_default` is deprecated, use `add_column` instead'.freeze MSG = '`add_column_with_default` is deprecated, use `add_column` instead'
def on_send(node) def on_send(node)
return unless in_migration?(node) return unless in_migration?(node)
......
...@@ -10,7 +10,7 @@ module RuboCop ...@@ -10,7 +10,7 @@ module RuboCop
class AddConcurrentForeignKey < RuboCop::Cop::Cop class AddConcurrentForeignKey < RuboCop::Cop::Cop
include MigrationHelpers include MigrationHelpers
MSG = '`add_foreign_key` requires downtime, use `add_concurrent_foreign_key` instead'.freeze MSG = '`add_foreign_key` requires downtime, use `add_concurrent_foreign_key` instead'
def_node_matcher :false_node?, <<~PATTERN def_node_matcher :false_node?, <<~PATTERN
(false) (false)
......
...@@ -11,7 +11,7 @@ module RuboCop ...@@ -11,7 +11,7 @@ module RuboCop
include MigrationHelpers include MigrationHelpers
MSG = '`add_concurrent_index` is not reversible so you must manually define ' \ MSG = '`add_concurrent_index` is not reversible so you must manually define ' \
'the `up` and `down` methods in your migration class, using `remove_concurrent_index` in `down`'.freeze 'the `up` and `down` methods in your migration class, using `remove_concurrent_index` in `down`'
def on_send(node) def on_send(node)
return unless in_migration?(node) return unless in_migration?(node)
......
...@@ -9,7 +9,7 @@ module RuboCop ...@@ -9,7 +9,7 @@ module RuboCop
class AddIndex < RuboCop::Cop::Cop class AddIndex < RuboCop::Cop::Cop
include MigrationHelpers include MigrationHelpers
MSG = '`add_index` requires downtime, use `add_concurrent_index` instead'.freeze MSG = '`add_index` requires downtime, use `add_concurrent_index` instead'
def on_def(node) def on_def(node)
return unless in_migration?(node) return unless in_migration?(node)
......
...@@ -14,7 +14,7 @@ module RuboCop ...@@ -14,7 +14,7 @@ module RuboCop
include MigrationHelpers include MigrationHelpers
MSG = 'Text columns should always have a limit set (255 is suggested). ' \ MSG = 'Text columns should always have a limit set (255 is suggested). ' \
'You can add a limit to a `text` column by using `add_text_limit`'.freeze 'You can add a limit to a `text` column by using `add_text_limit`'
def_node_matcher :reverting?, <<~PATTERN def_node_matcher :reverting?, <<~PATTERN
(def :down ...) (def :down ...)
......
...@@ -9,7 +9,7 @@ module RuboCop ...@@ -9,7 +9,7 @@ module RuboCop
class AddTimestamps < RuboCop::Cop::Cop class AddTimestamps < RuboCop::Cop::Cop
include MigrationHelpers include MigrationHelpers
MSG = 'Do not use `add_timestamps`, use `add_timestamps_with_timezone` instead'.freeze MSG = 'Do not use `add_timestamps`, use `add_timestamps_with_timezone` instead'
# Check methods. # Check methods.
def on_send(node) def on_send(node)
......
...@@ -9,7 +9,7 @@ module RuboCop ...@@ -9,7 +9,7 @@ module RuboCop
class Datetime < RuboCop::Cop::Cop class Datetime < RuboCop::Cop::Cop
include MigrationHelpers include MigrationHelpers
MSG = 'Do not use the `%s` data type, use `datetime_with_timezone` instead'.freeze MSG = 'Do not use the `%s` data type, use `datetime_with_timezone` instead'
# Check methods in table creation. # Check methods in table creation.
def on_def(node) def on_def(node)
......
...@@ -5,7 +5,7 @@ module RuboCop ...@@ -5,7 +5,7 @@ module RuboCop
class ProjectPathHelper < RuboCop::Cop::Cop class ProjectPathHelper < RuboCop::Cop::Cop
MSG = 'Use short project path helpers without explicitly passing the namespace: ' \ MSG = 'Use short project path helpers without explicitly passing the namespace: ' \
'`foo_project_bar_path(project, bar)` instead of ' \ '`foo_project_bar_path(project, bar)` instead of ' \
'`foo_namespace_project_bar_path(project.namespace, project, bar)`.'.freeze '`foo_namespace_project_bar_path(project.namespace, project, bar)`.'
METHOD_NAME_PATTERN = /\A([a-z_]+_)?namespace_project(?:_[a-z_]+)?_(?:url|path)\z/.freeze METHOD_NAME_PATTERN = /\A([a-z_]+_)?namespace_project(?:_[a-z_]+)?_(?:url|path)\z/.freeze
......
...@@ -19,7 +19,7 @@ module RuboCop ...@@ -19,7 +19,7 @@ module RuboCop
class AmbiguousPageObjectName < RuboCop::Cop::Cop class AmbiguousPageObjectName < RuboCop::Cop::Cop
include QAHelpers 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 def_node_matcher :ambiguous_page?, <<~PATTERN
(block (block
......
...@@ -19,7 +19,7 @@ module RuboCop ...@@ -19,7 +19,7 @@ module RuboCop
class ElementWithPattern < RuboCop::Cop::Cop class ElementWithPattern < RuboCop::Cop::Cop
include QAHelpers 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) def on_send(node)
return unless in_qa_file?(node) return unless in_qa_file?(node)
......
...@@ -17,7 +17,7 @@ module RuboCop ...@@ -17,7 +17,7 @@ module RuboCop
# stub_env('FOO', 'bar') # stub_env('FOO', 'bar')
# end # end
class EnvAssignment < RuboCop::Cop::Cop 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 def_node_search :env_assignment?, <<~PATTERN
(send (const nil? :ENV) :[]= ...) (send (const nil? :ENV) :[]= ...)
......
...@@ -14,7 +14,7 @@ module RuboCop ...@@ -14,7 +14,7 @@ module RuboCop
# let(:users) { table(:users) } # let(:users) { table(:users) }
# let(:user) { users.create!(name: 'User 1', username: 'user1') } # let(:user) { users.create!(name: 'User 1', username: 'user1') }
class FactoriesInMigrationSpecs < RuboCop::Cop::Cop 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 FORBIDDEN_METHODS = %i[build build_list create create_list attributes_for].freeze
def_node_search :forbidden_factory_usage?, <<~PATTERN def_node_search :forbidden_factory_usage?, <<~PATTERN
......
...@@ -13,7 +13,7 @@ module RuboCop ...@@ -13,7 +13,7 @@ module RuboCop
# # good # # good
# HTTParty.get(url, basic_auth: { username: 'foo' }) # HTTParty.get(url, basic_auth: { username: 'foo' })
class HTTPartyBasicAuth < RuboCop::Cop::Cop 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 RESTRICT_ON_SEND = %i(get put post delete).freeze
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module RuboCop module RuboCop
module Cop module Cop
class SafeParams < RuboCop::Cop::Cop class SafeParams < RuboCop::Cop::Cop
MSG = 'Use `safe_params` instead of `params` in url_for.'.freeze MSG = 'Use `safe_params` instead of `params` in url_for.'
METHOD_NAME_PATTERN = :url_for METHOD_NAME_PATTERN = :url_for
UNSAFE_PARAM = :params UNSAFE_PARAM = :params
......
...@@ -4,7 +4,7 @@ module RuboCop ...@@ -4,7 +4,7 @@ module RuboCop
module Cop module Cop
# Cop that prevents manually setting a queue in Sidekiq workers. # Cop that prevents manually setting a queue in Sidekiq workers.
class SidekiqOptionsQueue < RuboCop::Cop::Cop class SidekiqOptionsQueue < RuboCop::Cop::Cop
MSG = 'Do not manually set a queue; `ApplicationWorker` sets one automatically.'.freeze MSG = 'Do not manually set a queue; `ApplicationWorker` sets one automatically.'
def_node_matcher :sidekiq_options?, <<~PATTERN def_node_matcher :sidekiq_options?, <<~PATTERN
(send nil? :sidekiq_options $...) (send nil? :sidekiq_options $...)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module RuboCop module RuboCop
module Cop module Cop
class StaticTranslationDefinition < RuboCop::Cop::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 TRANSLATION_METHODS = %i[_ s_ n_].freeze
......
...@@ -14,7 +14,7 @@ RSpec.describe "User creates milestone", :js do ...@@ -14,7 +14,7 @@ RSpec.describe "User creates milestone", :js do
end end
it "creates milestone" do it "creates milestone" do
title = "v2.3".freeze title = "v2.3"
fill_in("Title", with: title) fill_in("Title", with: title)
fill_in("Description", with: "# Description header") fill_in("Description", with: "# Description header")
......
...@@ -16,7 +16,7 @@ RSpec.describe "User creates branch", :js do ...@@ -16,7 +16,7 @@ RSpec.describe "User creates branch", :js do
end end
it "creates new branch" do it "creates new branch" do
branch_name = "deploy_keys".freeze branch_name = "deploy_keys"
create_branch(branch_name) create_branch(branch_name)
...@@ -25,7 +25,7 @@ RSpec.describe "User creates branch", :js do ...@@ -25,7 +25,7 @@ RSpec.describe "User creates branch", :js do
context "when branch name is invalid" do context "when branch name is invalid" do
it "does not create new branch" 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) fill_in("branch_name", with: invalid_branch_name)
page.find("body").click # defocus the branch_name input page.find("body").click # defocus the branch_name input
......
...@@ -19,7 +19,7 @@ RSpec.describe "User edits a comment on a commit", :js do ...@@ -19,7 +19,7 @@ RSpec.describe "User edits a comment on a commit", :js do
end end
it "edits comment" do it "edits comment" do
new_comment_text = "+1 Awesome!".freeze new_comment_text = "+1 Awesome!"
page.within(".main-notes-list") do page.within(".main-notes-list") do
note = find(".note") note = find(".note")
......
...@@ -162,7 +162,7 @@ RSpec.describe Gitlab::Utils do ...@@ -162,7 +162,7 @@ RSpec.describe Gitlab::Utils do
describe '.nlbr' do describe '.nlbr' do
it 'replaces new lines with <br>' 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
end end
...@@ -388,8 +388,8 @@ RSpec.describe Gitlab::Utils do ...@@ -388,8 +388,8 @@ RSpec.describe Gitlab::Utils do
describe ".safe_downcase!" do describe ".safe_downcase!" do
where(:str, :result) do where(:str, :result) do
"test".freeze | "test" "test" | "test"
"Test".freeze | "test" "Test" | "test"
"test" | "test" "test" | "test"
"Test" | "test" "Test" | "test"
end end
......
...@@ -5,8 +5,8 @@ require 'fast_spec_helper' ...@@ -5,8 +5,8 @@ require 'fast_spec_helper'
require_relative '../../../../rubocop/cop/rspec/env_assignment' require_relative '../../../../rubocop/cop/rspec/env_assignment'
RSpec.describe RuboCop::Cop::RSpec::EnvAssignment do RSpec.describe RuboCop::Cop::RSpec::EnvAssignment do
offense_call_single_quotes_key = %(ENV['FOO'] = 'bar').freeze offense_call_single_quotes_key = %(ENV['FOO'] = 'bar')
offense_call_double_quotes_key = %(ENV["FOO"] = 'bar').freeze offense_call_double_quotes_key = %(ENV["FOO"] = 'bar')
let(:source_file) { 'spec/foo_spec.rb' } let(:source_file) { 'spec/foo_spec.rb' }
......
...@@ -5,7 +5,7 @@ RSpec.describe Packages::CreateDependencyService do ...@@ -5,7 +5,7 @@ RSpec.describe Packages::CreateDependencyService do
describe '#execute' do describe '#execute' do
let_it_be(:namespace) {create(:namespace)} let_it_be(:namespace) {create(:namespace)}
let_it_be(:version) { '1.0.1' } 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 context 'when packages are published' do
let(:json_file) { 'packages/npm/payload.json' } let(:json_file) { 'packages/npm/payload.json' }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
class CiArtifactMetadataGenerator class CiArtifactMetadataGenerator
attr_accessor :entries, :output 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) def initialize(stream)
@entries = {} @entries = {}
......
# frozen_string_literal: true # frozen_string_literal: true
module JiraServiceHelper module JiraServiceHelper
JIRA_URL = "http://jira.example.net".freeze JIRA_URL = "http://jira.example.net"
JIRA_API = JIRA_URL + "/rest/api/2" JIRA_API = JIRA_URL + "/rest/api/2"
def jira_service_settings def jira_service_settings
......
...@@ -31,64 +31,64 @@ ...@@ -31,64 +31,64 @@
module SeedRepo module SeedRepo
module BigCommit module BigCommit
ID = "913c66a37b4a45b9769037c55c2d238bd0942d2e".freeze ID = "913c66a37b4a45b9769037c55c2d238bd0942d2e"
PARENT_ID = "cfe32cf61b73a0d5e9f13e774abde7ff789b1660".freeze PARENT_ID = "cfe32cf61b73a0d5e9f13e774abde7ff789b1660"
MESSAGE = "Files, encoding and much more".freeze MESSAGE = "Files, encoding and much more"
AUTHOR_FULL_NAME = "Dmitriy Zaporozhets".freeze AUTHOR_FULL_NAME = "Dmitriy Zaporozhets"
FILES_COUNT = 2 FILES_COUNT = 2
end end
module Commit module Commit
ID = "570e7b2abdd848b95f2f578043fc23bd6f6fd24d".freeze ID = "570e7b2abdd848b95f2f578043fc23bd6f6fd24d"
PARENT_ID = "6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9".freeze PARENT_ID = "6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9"
MESSAGE = "Change some files\n\nSigned-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>\n".freeze MESSAGE = "Change some files\n\nSigned-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>\n"
AUTHOR_FULL_NAME = "Dmitriy Zaporozhets".freeze AUTHOR_FULL_NAME = "Dmitriy Zaporozhets"
FILES = ["files/ruby/popen.rb", "files/ruby/regex.rb"].freeze FILES = ["files/ruby/popen.rb", "files/ruby/regex.rb"].freeze
FILES_COUNT = 2 FILES_COUNT = 2
C_FILE_PATH = "files/ruby".freeze C_FILE_PATH = "files/ruby"
C_FILES = ["popen.rb", "regex.rb", "version_info.rb"].freeze 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 = %{%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".freeze BLOB_FILE_PATH = "app/views/keys/show.html.haml"
end end
module EmptyCommit module EmptyCommit
ID = "b0e52af38d7ea43cf41d8a6f2471351ac036d6c9".freeze ID = "b0e52af38d7ea43cf41d8a6f2471351ac036d6c9"
PARENT_ID = "40f4a7a617393735a95a0bb67b08385bc1e7c66d".freeze PARENT_ID = "40f4a7a617393735a95a0bb67b08385bc1e7c66d"
MESSAGE = "Empty commit".freeze MESSAGE = "Empty commit"
AUTHOR_FULL_NAME = "Rémy Coutable".freeze AUTHOR_FULL_NAME = "Rémy Coutable"
FILES = [].freeze FILES = [].freeze
FILES_COUNT = FILES.count FILES_COUNT = FILES.count
end end
module EncodingCommit module EncodingCommit
ID = "40f4a7a617393735a95a0bb67b08385bc1e7c66d".freeze ID = "40f4a7a617393735a95a0bb67b08385bc1e7c66d"
PARENT_ID = "66028349a123e695b589e09a36634d976edcc5e8".freeze PARENT_ID = "66028349a123e695b589e09a36634d976edcc5e8"
MESSAGE = "Add ISO-8859-encoded file".freeze MESSAGE = "Add ISO-8859-encoded file"
AUTHOR_FULL_NAME = "Stan Hu".freeze AUTHOR_FULL_NAME = "Stan Hu"
FILES = ["encoding/iso8859.txt"].freeze FILES = ["encoding/iso8859.txt"].freeze
FILES_COUNT = FILES.count FILES_COUNT = FILES.count
end end
module FirstCommit module FirstCommit
ID = "1a0b36b3cdad1d2ee32457c102a8c0b7056fa863".freeze ID = "1a0b36b3cdad1d2ee32457c102a8c0b7056fa863"
PARENT_ID = nil PARENT_ID = nil
MESSAGE = "Initial commit".freeze MESSAGE = "Initial commit"
AUTHOR_FULL_NAME = "Dmitriy Zaporozhets".freeze AUTHOR_FULL_NAME = "Dmitriy Zaporozhets"
FILES = ["LICENSE", ".gitignore", "README.md"].freeze FILES = ["LICENSE", ".gitignore", "README.md"].freeze
FILES_COUNT = 3 FILES_COUNT = 3
end end
module LastCommit module LastCommit
ID = "4b4918a572fa86f9771e5ba40fbd48e1eb03e2c6".freeze ID = "4b4918a572fa86f9771e5ba40fbd48e1eb03e2c6"
PARENT_ID = "0e1b353b348f8477bdbec1ef47087171c5032cd9".freeze PARENT_ID = "0e1b353b348f8477bdbec1ef47087171c5032cd9"
MESSAGE = "Merge branch 'master' into 'master'".freeze MESSAGE = "Merge branch 'master' into 'master'"
AUTHOR_FULL_NAME = "Stan Hu".freeze AUTHOR_FULL_NAME = "Stan Hu"
FILES = ["bin/executable"].freeze FILES = ["bin/executable"].freeze
FILES_COUNT = FILES.count FILES_COUNT = FILES.count
end end
module Repo module Repo
HEAD = "master".freeze HEAD = "master"
BRANCHES = %w[ BRANCHES = %w[
feature feature
fix fix
...@@ -111,9 +111,9 @@ module SeedRepo ...@@ -111,9 +111,9 @@ module SeedRepo
end end
module RubyBlob module RubyBlob
ID = "7e3e39ebb9b2bf433b4ad17313770fbe4051649c".freeze ID = "7e3e39ebb9b2bf433b4ad17313770fbe4051649c"
NAME = "popen.rb".freeze NAME = "popen.rb"
CONTENT = <<-eos.freeze CONTENT = <<-eos
require 'fileutils' require 'fileutils'
require 'open3' 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