diff --git a/.rubocop_todo/style/redundant_freeze.yml b/.rubocop_todo/style/redundant_freeze.yml index 0877c752827dfc567f568c7497b8ef8b5f1e2ec7..2d1a8d0d2dce92a92e65a50be9874450c60a382e 100644 --- a/.rubocop_todo/style/redundant_freeze.yml +++ b/.rubocop_todo/style/redundant_freeze.yml @@ -55,29 +55,6 @@ Style/RedundantFreeze: - 'app/validators/certificate_fingerprint_validator.rb' - 'app/validators/json_schema_validator.rb' - 'app/validators/line_code_validator.rb' - - 'ee/app/finders/concerns/epics/findable.rb' - - 'ee/app/finders/ee/analytics/cycle_analytics/stage_finder.rb' - - 'ee/app/finders/epics_finder.rb' - - 'ee/app/graphql/mutations/incident_management/oncall_rotation/base.rb' - - 'ee/app/graphql/types/incident_management/oncall_rotation_date_input_type.rb' - - 'ee/app/models/allowed_email_domain.rb' - - 'ee/app/models/ee/issue.rb' - - 'ee/app/models/ee/label.rb' - - 'ee/app/models/ee/project_import_state.rb' - - 'ee/app/models/ee/vulnerability.rb' - - 'ee/app/models/iteration.rb' - - 'ee/app/models/status_page/project_setting.rb' - - 'ee/app/serializers/analytics/cycle_analytics/value_stream_errors_serializer.rb' - - 'ee/app/services/elastic/data_migration_service.rb' - - 'ee/app/services/incident_management/issuable_resource_links/create_service.rb' - - 'ee/app/services/projects/restore_service.rb' - - 'ee/lib/ee/gitlab/path_regex.rb' - - 'ee/lib/ee/gitlab/web_hooks/rate_limiter.rb' - - 'ee/lib/elastic/latest/git_class_proxy.rb' - - 'ee/lib/gitlab/code_owners/reference_extractor.rb' - - 'ee/lib/gitlab/status_page/filter/image_filter.rb' - - 'ee/lib/system_check/geo/authorized_keys_check.rb' - - 'haml_lint/linter/documentation_links.rb' - 'lib/api/api.rb' - 'lib/api/concerns/packages/nuget_endpoints.rb' - 'lib/api/debian_group_packages.rb' diff --git a/ee/app/finders/concerns/epics/findable.rb b/ee/app/finders/concerns/epics/findable.rb index 2ff5dedd69c92dcf6b1eb3aa6a7df610c915a63d..a6ef9be5485d73aeb6d0889250a5fe507eabf33d 100644 --- a/ee/app/finders/concerns/epics/findable.rb +++ b/ee/app/finders/concerns/epics/findable.rb @@ -15,7 +15,7 @@ module Findable include Gitlab::Utils::StrongMemoize extend ::Gitlab::Utils::Override - IID_STARTS_WITH_PATTERN = %r{\A(\d)+\z}.freeze + IID_STARTS_WITH_PATTERN = %r{\A(\d)+\z} class_methods do def scalar_params diff --git a/ee/app/finders/ee/analytics/cycle_analytics/stage_finder.rb b/ee/app/finders/ee/analytics/cycle_analytics/stage_finder.rb index 864267c33d33da6cf5c4a70862a18cdc0b3e4dea..961003981ee4fe11687a146782a5b36e7a6cb5c4 100644 --- a/ee/app/finders/ee/analytics/cycle_analytics/stage_finder.rb +++ b/ee/app/finders/ee/analytics/cycle_analytics/stage_finder.rb @@ -6,7 +6,7 @@ module CycleAnalytics module StageFinder extend ::Gitlab::Utils::Override - NUMBERS_ONLY = /\A\d+\z/.freeze + NUMBERS_ONLY = /\A\d+\z/ def initialize(parent:, stage_id:) @parent = parent diff --git a/ee/app/finders/epics_finder.rb b/ee/app/finders/epics_finder.rb index 19e55333df2744ac1b77bea8e39d60da39e50ccf..9c72e09fc17028fd3c133e5262339159cdf51090 100644 --- a/ee/app/finders/epics_finder.rb +++ b/ee/app/finders/epics_finder.rb @@ -35,7 +35,7 @@ class EpicsFinder < IssuableFinder include Gitlab::Utils::StrongMemoize extend ::Gitlab::Utils::Override - IID_STARTS_WITH_PATTERN = %r{\A(\d)+\z}.freeze + IID_STARTS_WITH_PATTERN = %r{\A(\d)+\z} def self.valid_iid_query?(query) query.match?(IID_STARTS_WITH_PATTERN) diff --git a/ee/app/graphql/mutations/incident_management/oncall_rotation/base.rb b/ee/app/graphql/mutations/incident_management/oncall_rotation/base.rb index 473913179c7f6c5ca0649dc58204eb3c5b924a59..15916a1d9b755f636965eff9954e9899538cc471 100644 --- a/ee/app/graphql/mutations/incident_management/oncall_rotation/base.rb +++ b/ee/app/graphql/mutations/incident_management/oncall_rotation/base.rb @@ -5,7 +5,7 @@ module IncidentManagement module OncallRotation class Base < BaseMutation MAXIMUM_PARTICIPANTS = 100 - TIME_FORMAT = /^(0\d|1\d|2[0-3]):[0-5]\d$/.freeze + TIME_FORMAT = /^(0\d|1\d|2[0-3]):[0-5]\d$/ field :oncall_rotation, ::Types::IncidentManagement::OncallRotationType, diff --git a/ee/app/graphql/types/incident_management/oncall_rotation_date_input_type.rb b/ee/app/graphql/types/incident_management/oncall_rotation_date_input_type.rb index e5d4ac188105dda14d65feef5d15c59422e5166a..416506ee2f06490d1e36b200806d434ca17d7d08 100644 --- a/ee/app/graphql/types/incident_management/oncall_rotation_date_input_type.rb +++ b/ee/app/graphql/types/incident_management/oncall_rotation_date_input_type.rb @@ -14,8 +14,8 @@ class OncallRotationDateInputType < BaseInputObject required: true, description: 'Time component of the date in 24hr HH:MM format.' - DATE_FORMAT = %r[^\d{4}-[0123]\d-\d{2}$].freeze - TIME_FORMAT = %r[^(0\d|1\d|2[0-3]):[0-5]\d$].freeze + DATE_FORMAT = %r[^\d{4}-[0123]\d-\d{2}$] + TIME_FORMAT = %r[^(0\d|1\d|2[0-3]):[0-5]\d$] def prepare raise Gitlab::Graphql::Errors::ArgumentError, 'Date given is invalid' unless DATE_FORMAT.match?(date) diff --git a/ee/app/models/allowed_email_domain.rb b/ee/app/models/allowed_email_domain.rb index 0b709f6ebd87c48a2a4f8557e3484358531c6837..cc4c9c4f184517712a9a997cc62127855d4e7b30 100644 --- a/ee/app/models/allowed_email_domain.rb +++ b/ee/app/models/allowed_email_domain.rb @@ -27,10 +27,10 @@ class AllowedEmailDomain < ApplicationRecord VALID_DOMAIN_BASE = '(?=.*\.)[0-9a-zA-Z.-]+' # VALID_DOMAIN_REGEX is the regex we should be using to validate email domains in ruby - VALID_DOMAIN_REGEX = /\A#{VALID_DOMAIN_BASE}\z/.freeze + VALID_DOMAIN_REGEX = /\A#{VALID_DOMAIN_BASE}\z/ # JS_VALID_DOMAIN_REGEX is only for use on the frontend in javascript/vue - JS_VALID_DOMAIN_REGEX = /^#{VALID_DOMAIN_BASE}$/.freeze + JS_VALID_DOMAIN_REGEX = /^#{VALID_DOMAIN_BASE}$/ validates :group_id, presence: true validates :domain, presence: true diff --git a/ee/app/models/ee/issue.rb b/ee/app/models/ee/issue.rb index 17885998efd48e3bc25dbf90b91e1756fefb2eb8..fa11ed8484b5fc366b74883e5486544228ad1a57 100644 --- a/ee/app/models/ee/issue.rb +++ b/ee/app/models/ee/issue.rb @@ -6,7 +6,7 @@ module Issue extend ::Gitlab::Utils::Override prepended do - WEIGHT_RANGE = (0..20).freeze + WEIGHT_RANGE = (0..20) WEIGHT_ALL = 'Everything' WEIGHT_ANY = 'Any' WEIGHT_NONE = 'None' diff --git a/ee/app/models/ee/label.rb b/ee/app/models/ee/label.rb index bdca9df252f958473da2df266c26c5dcf928ad6c..fb09a600cae4352c5d1329d204227afc0ff61b6e 100644 --- a/ee/app/models/ee/label.rb +++ b/ee/app/models/ee/label.rb @@ -5,7 +5,7 @@ module Label extend ActiveSupport::Concern SCOPED_LABEL_SEPARATOR = '::' - SCOPED_LABEL_PATTERN = /^.*#{SCOPED_LABEL_SEPARATOR}/.freeze + SCOPED_LABEL_PATTERN = /^.*#{SCOPED_LABEL_SEPARATOR}/ prepended do has_many :epic_board_labels, class_name: 'Boards::EpicBoardLabel', inverse_of: :label diff --git a/ee/app/models/ee/project_import_state.rb b/ee/app/models/ee/project_import_state.rb index b090d09c11a9fb377716fef7b8d1cc5f4156f7fb..a655424a8cfe6b0fa970409cb39a607219d469c4 100644 --- a/ee/app/models/ee/project_import_state.rb +++ b/ee/app/models/ee/project_import_state.rb @@ -8,7 +8,7 @@ module ProjectImportState prepended do BACKOFF_PERIOD = 24.seconds JITTER = 6.seconds - SSL_CERTIFICATE_PROBLEM = /SSL certificate problem/.freeze + SSL_CERTIFICATE_PROBLEM = /SSL certificate problem/ delegate :mirror?, :mirror_with_content?, :archived, :pending_delete, to: :project diff --git a/ee/app/models/ee/vulnerability.rb b/ee/app/models/ee/vulnerability.rb index 468feba9378c83dc830810b28b900e5cdef45e7f..e0f7b84cd0f59d3991fc8bce5ba763d616b610aa 100644 --- a/ee/app/models/ee/vulnerability.rb +++ b/ee/app/models/ee/vulnerability.rb @@ -24,7 +24,7 @@ module Vulnerability ACTIVE_STATES = %w(detected confirmed).freeze PASSIVE_STATES = %w(dismissed resolved).freeze SUMMARY_DELIMITER = '|' - REGEX_CAPTURING_STATUS = /\A[\w+\s]+to\s(?<status>\w+)/.freeze + REGEX_CAPTURING_STATUS = /\A[\w+\s]+to\s(?<status>\w+)/ cache_markdown_field :title, pipeline: :single_line cache_markdown_field :description, issuable_reference_expansion_enabled: true diff --git a/ee/app/models/iteration.rb b/ee/app/models/iteration.rb index 130a034f7020992a00cb585dea5e6a7db9b208f7..54e43ae49472bdf7786ca9f067695f93a2250574 100644 --- a/ee/app/models/iteration.rb +++ b/ee/app/models/iteration.rb @@ -135,7 +135,7 @@ def reference_pattern "[^"]+" # String-based multi-word iteration surrounded in quotes ) ) - }x.freeze + }x end def link_reference_pattern diff --git a/ee/app/models/status_page/project_setting.rb b/ee/app/models/status_page/project_setting.rb index ca4b731f5430a876c05a3bc4809526ffcf783afc..e43adff92b2ef1c2eb230b8af63e711fb66550b5 100644 --- a/ee/app/models/status_page/project_setting.rb +++ b/ee/app/models/status_page/project_setting.rb @@ -3,9 +3,9 @@ module StatusPage class ProjectSetting < ApplicationRecord # AWS validations. See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/25863#note_295772553 - AWS_BUCKET_NAME_REGEXP = /\A[a-z0-9][a-z0-9\-.]*\z/.freeze - AWS_ACCESS_KEY_REGEXP = /\A[A-Z0-9]{20}\z/.freeze - AWS_SECRET_KEY_REGEXP = %r{\A[A-Za-z0-9/+=]{40}\z}.freeze + AWS_BUCKET_NAME_REGEXP = /\A[a-z0-9][a-z0-9\-.]*\z/ + AWS_ACCESS_KEY_REGEXP = /\A[A-Z0-9]{20}\z/ + AWS_SECRET_KEY_REGEXP = %r{\A[A-Za-z0-9/+=]{40}\z} self.table_name = 'status_page_settings' diff --git a/ee/app/serializers/analytics/cycle_analytics/value_stream_errors_serializer.rb b/ee/app/serializers/analytics/cycle_analytics/value_stream_errors_serializer.rb index ef48e4df629f2ff1eeb410cfb0855b8f23f540e1..ac5208dc06299c5008f2fe53a6dd6c8969940173 100644 --- a/ee/app/serializers/analytics/cycle_analytics/value_stream_errors_serializer.rb +++ b/ee/app/serializers/analytics/cycle_analytics/value_stream_errors_serializer.rb @@ -18,7 +18,7 @@ module CycleAnalytics # } # } class ValueStreamErrorsSerializer - STAGE_ATTRIBUTE_REGEX = /stages\[(\d+)\]\.(.+)/.freeze + STAGE_ATTRIBUTE_REGEX = /stages\[(\d+)\]\.(.+)/ def initialize(value_stream) @value_stream = value_stream diff --git a/ee/app/services/elastic/data_migration_service.rb b/ee/app/services/elastic/data_migration_service.rb index 718f3c3f325ab88c109ce400fe922005928dde4d..7afc4adab55fc1b9a4cc48f26f4a7365de629fb3 100644 --- a/ee/app/services/elastic/data_migration_service.rb +++ b/ee/app/services/elastic/data_migration_service.rb @@ -3,7 +3,7 @@ module Elastic class DataMigrationService MIGRATIONS_PATH = 'ee/elastic/migrate' - MIGRATION_REGEXP = /\A([0-9]+)_([_a-z0-9]*)\.rb\z/.freeze + MIGRATION_REGEXP = /\A([0-9]+)_([_a-z0-9]*)\.rb\z/ CACHE_TIMEOUT = 30.minutes class << self diff --git a/ee/app/services/incident_management/issuable_resource_links/create_service.rb b/ee/app/services/incident_management/issuable_resource_links/create_service.rb index e1d0d69f2b3ee5e602d23c81570554b0025fbea1..0de7f5b3e727e618a5fb338f3770a1aa83771ae5 100644 --- a/ee/app/services/incident_management/issuable_resource_links/create_service.rb +++ b/ee/app/services/incident_management/issuable_resource_links/create_service.rb @@ -3,9 +3,9 @@ module IncidentManagement module IssuableResourceLinks class CreateService < IssuableResourceLinks::BaseService - ZOOM_REGEXP = %r{https://(?:[\w-]+\.)?zoom\.us/(?:s|j|my)/\S+}.freeze - SLACK_REGEXP = %r{https://[a-zA-Z0-9]+.slack\.com/[a-z][a-zA-Z0-9_]+}.freeze - PAGERDUTY_REGEXP = %r{https://[a-zA-Z0-9]+.pagerduty\.com/incidents/[a-zA-Z0-9]+}.freeze + ZOOM_REGEXP = %r{https://(?:[\w-]+\.)?zoom\.us/(?:s|j|my)/\S+} + SLACK_REGEXP = %r{https://[a-zA-Z0-9]+.slack\.com/[a-z][a-zA-Z0-9_]+} + PAGERDUTY_REGEXP = %r{https://[a-zA-Z0-9]+.pagerduty\.com/incidents/[a-zA-Z0-9]+} def initialize(incident, user, params) @incident = incident diff --git a/ee/app/services/projects/restore_service.rb b/ee/app/services/projects/restore_service.rb index 71fa8ae138fbffb2802717c5f96dc7785b70dcc8..3bfd9d5896ca538735dae2f39804ccccb7dd2182 100644 --- a/ee/app/services/projects/restore_service.rb +++ b/ee/app/services/projects/restore_service.rb @@ -4,7 +4,7 @@ module Projects class RestoreService < BaseService include Gitlab::Utils::StrongMemoize - DELETED_SUFFIX_REGEX = /-deleted-[a-zA-Z0-9]+\z/.freeze + DELETED_SUFFIX_REGEX = /-deleted-[a-zA-Z0-9]+\z/ def execute return error(_('Project already deleted')) if project.pending_delete? diff --git a/ee/lib/ee/gitlab/path_regex.rb b/ee/lib/ee/gitlab/path_regex.rb index 28e302905d94cc40b02b943cf11f42f7499becf0..43a359284acf3e35918707db3eb3a27f07ded99e 100644 --- a/ee/lib/ee/gitlab/path_regex.rb +++ b/ee/lib/ee/gitlab/path_regex.rb @@ -7,7 +7,7 @@ module PathRegex class_methods do def saml_callback_regex - @saml_callback_regex ||= %r(\A\/groups\/(?<group>#{full_namespace_route_regex})\/\-\/saml\/callback\z).freeze + @saml_callback_regex ||= %r(\A\/groups\/(?<group>#{full_namespace_route_regex})\/\-\/saml\/callback\z) end end end diff --git a/ee/lib/ee/gitlab/web_hooks/rate_limiter.rb b/ee/lib/ee/gitlab/web_hooks/rate_limiter.rb index 15ec6db5e1689351f5df3049f06ae6aa6a18d137..324280d19833c4794361f1a6cc4035854d932fb7 100644 --- a/ee/lib/ee/gitlab/web_hooks/rate_limiter.rb +++ b/ee/lib/ee/gitlab/web_hooks/rate_limiter.rb @@ -10,8 +10,8 @@ module RateLimiter MID_RATE_LIMIT = :web_hook_calls_mid HIGH_RATE_LIMIT = ::Gitlab::WebHooks::RateLimiter::LIMIT_NAME - PREMIUM_MID_RANGE = (100..399).freeze - ULTIMATE_MID_RANGE = (1_000..4_999).freeze + PREMIUM_MID_RANGE = (100..399) + ULTIMATE_MID_RANGE = (1_000..4_999) LIMIT_MAP = { Plan::BRONZE => PREMIUM_MID_RANGE, diff --git a/ee/lib/elastic/latest/git_class_proxy.rb b/ee/lib/elastic/latest/git_class_proxy.rb index 2ffd56706bbe49a18756e60ff60b242c32d25d5f..ee7c01948566826d587aaf90dcdaecd0f92b9045 100644 --- a/ee/lib/elastic/latest/git_class_proxy.rb +++ b/ee/lib/elastic/latest/git_class_proxy.rb @@ -4,7 +4,7 @@ module Elastic module Latest module GitClassProxy extend ::Gitlab::Utils::Override - SHA_REGEX = /\A[0-9a-f]{5,40}\z/i.freeze + SHA_REGEX = /\A[0-9a-f]{5,40}\z/i HIGHLIGHT_START_TAG = 'gitlabelasticsearch→' HIGHLIGHT_END_TAG = 'â†gitlabelasticsearch' MAX_LANGUAGES = 100 diff --git a/ee/lib/gitlab/code_owners/reference_extractor.rb b/ee/lib/gitlab/code_owners/reference_extractor.rb index 60c9eabc696a2576e6f8e68ccc7e9b7566131ee6..66a1b7cbff788453e4bb3113af3fb01edc38d5b3 100644 --- a/ee/lib/gitlab/code_owners/reference_extractor.rb +++ b/ee/lib/gitlab/code_owners/reference_extractor.rb @@ -8,7 +8,7 @@ module CodeOwners class ReferenceExtractor # Not using `Devise.email_regexp` to filter out any chars that an email # does not end with and not pinning the email to a start of end of a string. - EMAIL_REGEXP = /(?<email>([^@\s]+@[^@\s]+(?<!\W)))/.freeze + EMAIL_REGEXP = /(?<email>([^@\s]+@[^@\s]+(?<!\W)))/ NAME_REGEXP = User.reference_pattern def initialize(text) diff --git a/ee/lib/gitlab/status_page/filter/image_filter.rb b/ee/lib/gitlab/status_page/filter/image_filter.rb index 9559dd37c91407b917ed1c202d9c185cc4468694..2e84dd4675c1b514ba629c5a290d6caf0295f518 100644 --- a/ee/lib/gitlab/status_page/filter/image_filter.rb +++ b/ee/lib/gitlab/status_page/filter/image_filter.rb @@ -7,7 +7,7 @@ module StatusPage module Filter class ImageFilter < HTML::Pipeline::Filter # Part of FileUploader::MARKDOWN_PATTERN but with a non-greedy file name matcher (?<file>.*) vs (?<file>.*?) - NON_GREEDY_UPLOAD_FILE_PATH_PATTERN = %r{/uploads/(?<secret>[0-9a-f]{32})/(?<file>.*)}.freeze + NON_GREEDY_UPLOAD_FILE_PATH_PATTERN = %r{/uploads/(?<secret>[0-9a-f]{32})/(?<file>.*)} CSS = 'img' XPATH = Gitlab::Utils::Nokogiri.css_to_xpath(CSS).freeze diff --git a/ee/lib/system_check/geo/authorized_keys_check.rb b/ee/lib/system_check/geo/authorized_keys_check.rb index e45cc01cbe2b82e7de8a40575eed18a40b84ee48..37df82967b3a5ac1fe591dfdf2ede48373b33cfc 100644 --- a/ee/lib/system_check/geo/authorized_keys_check.rb +++ b/ee/lib/system_check/geo/authorized_keys_check.rb @@ -16,7 +16,7 @@ class AuthorizedKeysCheck < ::SystemCheck::BaseCheck \k<quote> # boundary for command, backtracks the same detected quote, or none \s* # optional any amount of space character (?:\#.*)?$ # optional start-comment symbol followed by optionally any character until end of line - }x.freeze + }x OPENSSH_AUTHORIZED_KEYS_USER_REGEXP = %r{ ^AuthorizedKeysCommandUser # line starts with \s+ # one space or more @@ -25,7 +25,7 @@ class AuthorizedKeysCheck < ::SystemCheck::BaseCheck \k<quote> # boundary for command, backtracks the same detected quote, or none \s* # optional any amount of space character (?:\#.*)?$ # optional start-comment symbol followed by optionally any character until end of line - }x.freeze + }x OPENSSH_EXPECTED_COMMAND = '/opt/gitlab/embedded/service/gitlab-shell/bin/gitlab-shell-authorized-keys-check git %u %k' def multi_check diff --git a/haml_lint/linter/documentation_links.rb b/haml_lint/linter/documentation_links.rb index 9d80344dd20239f1c072a941aa223c5ab071aeb7..3c99c295e2df2a673f6531fbbed990000a7325c9 100644 --- a/haml_lint/linter/documentation_links.rb +++ b/haml_lint/linter/documentation_links.rb @@ -17,7 +17,7 @@ class DocumentationLinks < Linter (send _ {:help_page_url :help_page_path} $...) PATTERN - MARKDOWN_HEADER = %r{\A\#{1,6}\s+(?<header>.+)\Z}.freeze + MARKDOWN_HEADER = %r{\A\#{1,6}\s+(?<header>.+)\Z} def visit_script(node) check(node)