Commit 92641b39 authored by Sean McGivern's avatar Sean McGivern

Merge branch '31343-remove-unnecessary-use-of-freeze5' into 'master'

Remove unnecessary use of freeze

See merge request gitlab-org/gitlab!57060
parents e60f0ece 36dbcb11
---
title: Remove unnecessary use of freeze
merge_request: 57060
author: Lee Tickett @leetickett
type: other
......@@ -11,7 +11,7 @@ module RuboCop
include MigrationHelpers
MSG = 'hash indexes should be avoided at all costs since they are not ' \
'recorded in the PostgreSQL WAL, you should use a btree index instead'.freeze
'recorded in the PostgreSQL WAL, you should use a btree index instead'
NAMES = Set.new([:add_index, :index, :add_concurrent_index]).freeze
......
......@@ -11,7 +11,7 @@ module RuboCop
MSG = 'Do not use the `string` data type, use `text` instead. ' \
'Updating limits on strings requires downtime. This can be avoided ' \
'by using `text` and adding a limit with `add_text_limit`'.freeze
'by using `text` and adding a limit with `add_text_limit`'
def_node_matcher :reverting?, <<~PATTERN
(def :down ...)
......
......@@ -10,7 +10,7 @@ module RuboCop
class RemoveColumn < RuboCop::Cop::Cop
include MigrationHelpers
MSG = '`remove_column` must only be used in post-deployment migrations'.freeze
MSG = '`remove_column` must only be used in post-deployment migrations'
def on_def(node)
def_method = node.children[0]
......
......@@ -11,7 +11,7 @@ module RuboCop
include MigrationHelpers
MSG = '`remove_concurrent_index` is not reversible so you must manually define ' \
'the `up` and `down` methods in your migration class, using `add_concurrent_index` in `down`'.freeze
'the `up` and `down` methods in your migration class, using `add_concurrent_index` in `down`'
def on_send(node)
return unless in_migration?(node)
......
......@@ -9,7 +9,7 @@ module RuboCop
class RemoveIndex < RuboCop::Cop::Cop
include MigrationHelpers
MSG = '`remove_index` requires downtime, use `remove_concurrent_index` instead'.freeze
MSG = '`remove_index` requires downtime, use `remove_concurrent_index` instead'
def on_def(node)
return unless in_migration?(node)
......
......@@ -21,9 +21,9 @@ module RuboCop
class SaferBooleanColumn < RuboCop::Cop::Cop
include MigrationHelpers
DEFAULT_OFFENSE = 'Boolean columns on the `%s` table should have a default. You may wish to use `add_column_with_default`.'.freeze
NULL_OFFENSE = 'Boolean columns on the `%s` table should disallow nulls.'.freeze
DEFAULT_AND_NULL_OFFENSE = 'Boolean columns on the `%s` table should have a default and should disallow nulls. You may wish to use `add_column_with_default`.'.freeze
DEFAULT_OFFENSE = 'Boolean columns on the `%s` table should have a default. You may wish to use `add_column_with_default`.'
NULL_OFFENSE = 'Boolean columns on the `%s` table should disallow nulls.'
DEFAULT_AND_NULL_OFFENSE = 'Boolean columns on the `%s` table should have a default and should disallow nulls. You may wish to use `add_column_with_default`.'
def_node_matcher :add_column?, <<~PATTERN
(send nil? :add_column $...)
......
......@@ -9,7 +9,7 @@ module RuboCop
class Timestamps < RuboCop::Cop::Cop
include MigrationHelpers
MSG = 'Do not use `timestamps`, use `timestamps_with_timezone` instead'.freeze
MSG = 'Do not use `timestamps`, use `timestamps_with_timezone` instead'
# Check methods in table creation.
def on_def(node)
......
......@@ -11,7 +11,7 @@ module RuboCop
include MigrationHelpers
MSG = 'Migration running `update_column_in_batches` must have a spec file at' \
' `%s`.'.freeze
' `%s`.'
def on_send(node)
return unless in_migration?(node)
......
......@@ -10,7 +10,7 @@ module RuboCop
include MigrationHelpers
MSG = '`with_lock_retries` cannot be used within `change` so you must manually define ' \
'the `up` and `down` methods in your migration class and use `with_lock_retries` in both methods'.freeze
'the `up` and `down` methods in your migration class and use `with_lock_retries` in both methods'
def on_send(node)
return unless in_migration?(node)
......
......@@ -13,7 +13,7 @@ module RuboCop
# distinct_count(Ci::Build, :commit_id)
#
class DistinctCountByLargeForeignKey < RuboCop::Cop::Cop
MSG = 'Avoid doing `%s` on foreign keys for large tables having above 100 million rows.'.freeze
MSG = 'Avoid doing `%s` on foreign keys for large tables having above 100 million rows.'
def_node_matcher :distinct_count?, <<-PATTERN
(send _ $:distinct_count $...)
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
RSpec.describe Gitlab::Auth::OAuth::AuthHash do
let(:provider) { 'ldap'.freeze }
let(:provider) { 'ldap' }
let(:auth_hash) do
described_class.new(
OmniAuth::AuthHash.new(
......
......@@ -14,7 +14,7 @@ module StubENV
private
STUBBED_KEY = '__STUBBED__'.freeze
STUBBED_KEY = '__STUBBED__'
def add_stubbed_value(key, value)
allow(ENV).to receive(:[]).with(key).and_return(value)
......
# frozen_string_literal: true
module StubRequests
IP_ADDRESS_STUB = '8.8.8.9'.freeze
IP_ADDRESS_STUB = '8.8.8.9'
# Fully stubs a request using WebMock class. This class also
# stubs the IP address the URL is translated to (DNS lookup).
......
......@@ -92,7 +92,7 @@ module TestEnv
}.freeze
TMP_TEST_PATH = Rails.root.join('tmp', 'tests').freeze
REPOS_STORAGE = 'default'.freeze
REPOS_STORAGE = 'default'
SECOND_STORAGE_PATH = Rails.root.join('tmp', 'tests', 'second_storage')
# Test environment
......
......@@ -30,7 +30,7 @@ module Tooling
specs
].freeze
MESSAGE_PREFIX = '==>'.freeze
MESSAGE_PREFIX = '==>'
# First-match win, so be sure to put more specific regex at the top...
CATEGORIES = {
......
......@@ -2,7 +2,7 @@
module Tooling
class TestMapPacker
SEPARATOR = '/'.freeze
SEPARATOR = '/'
MARKER = 1
def pack(map)
......
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