A platform for community discussion. Free, open, simple.
DEV: Enable some minor rubocop rules (#40094)
Jarek Radoszd89531f2f66c
diff --git a/.rubocop.yml b/.rubocop.ymlindex 64372cac161..ef498f87d2b 100644--- a/.rubocop.yml+++ b/.rubocop.yml@@ -47,3 +47,18 @@ RSpec/InstanceVariable:Enabled: trueInclude:- spec/models/**/*++Style/RedundantFreeze:+ Enabled: true++Style/RedundantConditional:+ Enabled: true++Lint/DuplicateMagicComment:+ Enabled: true++Lint/IdentityComparison:+ Enabled: true++Lint/SymbolConversion:+ Enabled: truediff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rbindex 7defc1d84e8..c7d9945718c 100644--- a/app/controllers/groups_controller.rb+++ b/app/controllers/groups_controller.rb@@ -927,7 +927,7 @@ class GroupsController < ApplicationControllertags = {}NotificationLevels.all.each do |key, value|- category_ids = (params["#{key}_category_ids".to_sym] || []) - ["-1"]+ category_ids = (params[:"#{key}_category_ids"] || []) - ["-1"]category_ids.each do |category_id|category_id = category_id.to_i@@ -947,7 +947,7 @@ class GroupsController < ApplicationControllercategories[category_id] = metadataend- tag_names = (params["#{key}_tags".to_sym] || []) - ["-1"]+ tag_names = (params[:"#{key}_tags"] || []) - ["-1"]tag_ids = Tag.where(name: tag_names).pluck(:id)tag_ids.each do |tag_id|diff --git a/app/models/concerns/has_custom_fields.rb b/app/models/concerns/has_custom_fields.rbindex ed40890c955..0170eaa4966 100644--- a/app/models/concerns/has_custom_fields.rb+++ b/app/models/concerns/has_custom_fields.rb@@ -103,7 +103,7 @@ module HasCustomFields# and create a "sideloaded" version for easy querying by id.def custom_fields_for_ids(ids, allowed_fields)klass = "#{name}CustomField".constantize- foreign_key = "#{name.underscore}_id".to_sym+ foreign_key = :"#{name.underscore}_id"result = {}diff --git a/app/models/concerns/has_destroyed_web_hook.rb b/app/models/concerns/has_destroyed_web_hook.rbindex 592091473e7..1cd736fc9a5 100644--- a/app/models/concerns/has_destroyed_web_hook.rb+++ b/app/models/concerns/has_destroyed_web_hook.rb@@ -11,7 +11,7 @@ module HasDestroyedWebHookif WebHook.active_web_hooks("#{type}_destroyed").exists?payload = WebHook.generate_payload(type, self)yield- WebHook.enqueue_hooks(type, "#{type}_destroyed".to_sym, id: id, payload: payload)+ WebHook.enqueue_hooks(type, :"#{type}_destroyed", id: id, payload: payload)elseyieldenddiff --git a/app/models/concerns/searchable.rb b/app/models/concerns/searchable.rbindex 84ba85843b9..aaea8d98451 100644--- a/app/models/concerns/searchable.rb+++ b/app/models/concerns/searchable.rb@@ -5,5 +5,5 @@ module SearchablePRIORITIES = Enum.new(ignore: 1, very_low: 2, low: 3, normal: 0, high: 4, very_high: 5)- included { has_one "#{self.name.underscore}_search_data".to_sym, dependent: :destroy }+ included { has_one :"#{self.name.underscore}_search_data", dependent: :destroy }enddiff --git a/app/models/emoji.rb b/app/models/emoji.rbindex 2e57be3fe90..807e08a8337 100644--- a/app/models/emoji.rb+++ b/app/models/emoji.rb@@ -7,7 +7,7 @@ class EmojiFITZPATRICK_SCALE = %w[1f3fb 1f3fc 1f3fd 1f3fe 1f3ff]# matches emoji codes in text, e.g. :smile: or :wave:t2:- EMOJI_CODE_REGEXP = /:([\w\-+]+(?::t\d)?):/.freeze+ EMOJI_CODE_REGEXP = /:([\w\-+]+(?::t\d)?):/DEFAULT_GROUP = "default"diff --git a/app/models/reviewable.rb b/app/models/reviewable.rbindex 65f59d37052..f6dd804ad4f 100644--- a/app/models/reviewable.rb+++ b/app/models/reviewable.rb@@ -354,7 +354,7 @@ class Reviewable < ActiveRecord::Base# the result of the operation and whether the status of the reviewable changed.def perform(performed_by, action_id, args = nil)args ||= {}- perform_method = "perform_#{aliases[action_id] || action_id}".to_sym+ perform_method = :"perform_#{aliases[action_id] || action_id}"guardian = args[:guardian] || Guardian.new(performed_by)validate_action!(guardian, action_id, perform_method, args)diff --git a/app/models/stat.rb b/app/models/stat.rbindex 02eebbba64e..2a762306350 100644--- a/app/models/stat.rb+++ b/app/models/stat.rb@@ -27,7 +27,7 @@ class Statprivatedef build_key(key)- "#{@name}_#{key}".to_sym+ :"#{@name}_#{key}"enddef self._all_statsdiff --git a/app/models/user_notification_schedule.rb b/app/models/user_notification_schedule.rbindex 41ce83bd550..f298c47f0dc 100644--- a/app/models/user_notification_schedule.rb+++ b/app/models/user_notification_schedule.rb@@ -6,8 +6,8 @@ class UserNotificationSchedule < ActiveRecord::BaseDEFAULT = -> doattrs = { enabled: false }7.times do |n|- attrs["day_#{n}_start_time".to_sym] = 480- attrs["day_#{n}_end_time".to_sym] = 1020+ attrs[:"day_#{n}_start_time"] = 480+ attrs[:"day_#{n}_end_time"] = 1020endattrsend.calldiff --git a/app/serializers/post_revision_serializer.rb b/app/serializers/post_revision_serializer.rbindex 725b0745aff..9247908cc62 100644--- a/app/serializers/post_revision_serializer.rb+++ b/app/serializers/post_revision_serializer.rb@@ -34,7 +34,7 @@ class PostRevisionSerializer < ApplicationSerializer# Creates a field called field_name_changes with previous and# current members if a field has changed in this revisiondef self.add_compared_field(field)- changes_name = "#{field}_changes".to_sym+ changes_name = :"#{field}_changes"self.attributes changes_namedefine_method(changes_name) { { previous: previous[field], current: current[field] } }diff --git a/app/serializers/post_serializer.rb b/app/serializers/post_serializer.rbindex cd764d6e1a7..d24bde7a61a 100644--- a/app/serializers/post_serializer.rb+++ b/app/serializers/post_serializer.rb@@ -339,7 +339,7 @@ class PostSerializer < BasicPostSerializerignored_like_count = ignored_like_count_for_viewer@post_action_type_view.types.each do |sym, id|- count_col = "#{sym}_count".to_sym+ count_col = :"#{sym}_count"count = object.public_send(count_col) if object.respond_to?(count_col)count = [count.to_i - ignored_like_count, 0].max if count && sym == :likediff --git a/app/services/post_alerter.rb b/app/services/post_alerter.rbindex 8660764a99b..6242ad61634 100644--- a/app/services/post_alerter.rb+++ b/app/services/post_alerter.rb@@ -471,7 +471,7 @@ class PostAlerterNotification.consolidate_or_create!(notification_type: Notification.types[:group_message_summary],user_id: user.id,- read: user.id === acting_user_id ? true : false,+ read: user.id === acting_user_id,data: {group_id: stat[:group_id],group_name: stat[:group_name],diff --git a/app/services/user_updater.rb b/app/services/user_updater.rbindex 2d752c53b56..c00df7226d4 100644--- a/app/services/user_updater.rb+++ b/app/services/user_updater.rb@@ -66,8 +66,8 @@ class UserUpdaterNOTIFICATION_SCHEDULE_ATTRS = -> doattrs = [:enabled]7.times do |n|- attrs.push("day_#{n}_start_time".to_sym)- attrs.push("day_#{n}_end_time".to_sym)+ attrs.push(:"day_#{n}_start_time")+ attrs.push(:"day_#{n}_end_time")end{ user_notification_schedule: attrs }end.calldiff --git a/config/initializers/000-trace_pg_connections.rb b/config/initializers/000-trace_pg_connections.rbindex 822f1c69d0c..0b91e336b1e 100644--- a/config/initializers/000-trace_pg_connections.rb+++ b/config/initializers/000-trace_pg_connections.rb@@ -80,7 +80,7 @@ if ENV["TRACE_PG_CONNECTIONS"]]LOG_ACCESS_METHODS.each do |method|- new_method = "#{method}_without_logging".to_sym+ new_method = :"#{method}_without_logging"alias_method new_method, methoddefine_method(method) { |*args, &blk| log_access { send(new_method, *args, &blk) } }diff --git a/db/migrate/20131223171005_create_top_topics.rb b/db/migrate/20131223171005_create_top_topics.rbindex ec1b05882ad..8ecb6ba8c84 100644--- a/db/migrate/20131223171005_create_top_topics.rb+++ b/db/migrate/20131223171005_create_top_topics.rb@@ -9,18 +9,14 @@ class CreateTopTopics < ActiveRecord::Migration[4.2]t.belongs_to :topicPERIODS.each do |period|- SORT_ORDERS.each do |sort|- t.integer "#{period}_#{sort}_count".to_sym, null: false, default: 0- end+ SORT_ORDERS.each { |sort| t.integer :"#{period}_#{sort}_count", null: false, default: 0 }endendadd_index :top_topics, :topic_id, unique: truePERIODS.each do |period|- SORT_ORDERS.each do |sort|- add_index :top_topics, "#{period}_#{sort}_count".to_sym, order: "desc"- end+ SORT_ORDERS.each { |sort| add_index :top_topics, :"#{period}_#{sort}_count", order: "desc" }endendenddiff --git a/db/migrate/20131227164338_add_scores_to_top_topics.rb b/db/migrate/20131227164338_add_scores_to_top_topics.rbindex addeb688a2d..01e6736bae8 100644--- a/db/migrate/20131227164338_add_scores_to_top_topics.rb+++ b/db/migrate/20131227164338_add_scores_to_top_topics.rb@@ -3,7 +3,7 @@class AddScoresToTopTopics < ActiveRecord::Migration[4.2]def change%i[daily weekly monthly yearly].each do |period|- add_column :top_topics, "#{period}_score".to_sym, :float+ add_column :top_topics, :"#{period}_score", :floatendendenddiff --git a/db/migrate/20140408152401_add_default_value_to_top_topic_scores.rb b/db/migrate/20140408152401_add_default_value_to_top_topic_scores.rbindex 33dd9d7da5a..5d1dd4ed37c 100644--- a/db/migrate/20140408152401_add_default_value_to_top_topic_scores.rb+++ b/db/migrate/20140408152401_add_default_value_to_top_topic_scores.rb@@ -3,7 +3,7 @@class AddDefaultValueToTopTopicScores < ActiveRecord::Migration[4.2]def change%i[daily weekly monthly yearly].each do |period|- change_column_default :top_topics, "#{period}_score".to_sym, 0+ change_column_default :top_topics, :"#{period}_score", 0endendenddiff --git a/db/migrate/20200611104600_create_missing_badge_indexes.rb b/db/migrate/20200611104600_create_missing_badge_indexes.rbindex 7750d8118b6..05f7a953ed8 100644--- a/db/migrate/20200611104600_create_missing_badge_indexes.rb+++ b/db/migrate/20200611104600_create_missing_badge_indexes.rb@@ -5,8 +5,6 @@# Since then, rails made it work https://github.com/rails/rails/commit/9a0d35e820464f872b0340366dded639f00e19b9# This migration adds the index to very old sites, so that we have a consistent state-# frozen_string_literal: true-class CreateMissingBadgeIndexes < ActiveRecord::Migration[6.0]def upexecute "CREATE INDEX IF NOT EXISTS index_user_badges_on_user_id ON public.user_badges USING btree (user_id)"diff --git a/lib/discourse_dev/record.rb b/lib/discourse_dev/record.rbindex c2555bb4d48..7da22cf060b 100644--- a/lib/discourse_dev/record.rb+++ b/lib/discourse_dev/record.rb@@ -6,7 +6,7 @@ require "faker"module DiscourseDevclass Record- DEFAULT_COUNT = 30.freeze+ DEFAULT_COUNT = 30AUTO_POPULATED = "auto_populated"attr_reader :model, :typediff --git a/lib/discourse_plugin_registry.rb b/lib/discourse_plugin_registry.rbindex b6544fe6291..9a78fc31990 100644--- a/lib/discourse_plugin_registry.rb+++ b/lib/discourse_plugin_registry.rb@@ -138,7 +138,7 @@ class DiscoursePluginRegistrydefine_filtered_register :reviewable_types do |singleton|singleton.define_singleton_method("reviewable_types_lookup") do- public_send(:"_raw_reviewable_types")+ public_send(:_raw_reviewable_types).filter_map { |h| { plugin: h[:plugin].name, klass: h[:value] } if h[:plugin].enabled? }.uniqenddiff --git a/lib/filter_best_posts.rb b/lib/filter_best_posts.rbindex 2ee63d35b55..09cb3cbe30e 100644--- a/lib/filter_best_posts.rb+++ b/lib/filter_best_posts.rb@@ -7,7 +7,7 @@ class FilterBestPosts@filtered_posts = filtered_posts@topic = topic@limit = limit- options.each { |key, value| self.instance_variable_set("@#{key}".to_sym, value) }+ options.each { |key, value| self.instance_variable_set(:"@#{key}", value) }filterenddiff --git a/lib/freedom_patches/net_http_header.rb b/lib/freedom_patches/net_http_header.rbindex b7f743864d4..84ecb7278dd 100644--- a/lib/freedom_patches/net_http_header.rb+++ b/lib/freedom_patches/net_http_header.rb@@ -5,7 +5,7 @@ module NetHTTPHeaderPatch# If no user-agent is set, set it to the defaultinitheader ||= {}user_agent_key =- initheader.keys.find { |key| key.to_s.downcase == "user-agent" } || "User-Agent".to_sym+ initheader.keys.find { |key| key.to_s.downcase == "user-agent" } || :"User-Agent"initheader[user_agent_key] ||= Discourse.user_agentsuper initheaderdiff --git a/lib/onebox/open_graph.rb b/lib/onebox/open_graph.rbindex d25075222b7..16297cd0bee 100644--- a/lib/onebox/open_graph.rb+++ b/lib/onebox/open_graph.rb@@ -39,7 +39,7 @@ module Oneboxkey = $1.tr("-:", "_").to_symdata[key] ||= valueif key.in?(COLLECTIONS)- collection_name = "#{key}s".to_sym+ collection_name = :"#{key}s"data[collection_name] ||= []data[collection_name] << valueenddiff --git a/lib/post_revisor.rb b/lib/post_revisor.rbindex 7c6d0ab1cd4..5bb5aea7a8c 100644--- a/lib/post_revisor.rb+++ b/lib/post_revisor.rb@@ -113,7 +113,7 @@ class PostRevisortracked_topic_fields[field] = block# Define it in the serializer unless it already has been defined- if PostRevisionSerializer.instance_methods(false).exclude?("#{field}_changes".to_sym)+ if PostRevisionSerializer.instance_methods(false).exclude?(:"#{field}_changes")PostRevisionSerializer.add_compared_field(field)endenddiff --git a/lib/search/grouped_search_results.rb b/lib/search/grouped_search_results.rbindex 0d30df4b1cf..69a08f5ac1c 100644--- a/lib/search/grouped_search_results.rb+++ b/lib/search/grouped_search_results.rb@@ -112,7 +112,7 @@ class Searchif !@is_header_search && public_send(type).length == Search.per_filter@more_full_page_results = trueelsif @is_header_search && public_send(type).length == Search.per_facet- instance_variable_set("@more_#{type}".to_sym, true)+ instance_variable_set(:"@more_#{type}", true)else(self.public_send(type)) << objectenddiff --git a/lib/service/base.rb b/lib/service/base.rbindex 338f4985dee..ca410e526f1 100644--- a/lib/service/base.rb+++ b/lib/service/base.rb@@ -252,7 +252,7 @@ module Servicedef runrun!rescue Failure => exception- raise if context.object_id != exception.context.object_id+ raise if !context.equal?(exception.context)end# @!visibility privatediff --git a/lib/site_settings/defaults_provider.rb b/lib/site_settings/defaults_provider.rbindex 2e1ec862df1..c10d5615938 100644--- a/lib/site_settings/defaults_provider.rb+++ b/lib/site_settings/defaults_provider.rb@@ -105,7 +105,7 @@ class SiteSettings::DefaultsProviderenddef has_setting?(name)- has_key?(name.to_sym) || has_key?("#{name}?".to_sym) || name.to_sym == :default_locale+ has_key?(name.to_sym) || has_key?(:"#{name}?") || name.to_sym == :default_localeendprivatediff --git a/lib/site_settings/type_supervisor.rb b/lib/site_settings/type_supervisor.rbindex 0929f8f14f4..3322fe11151 100644--- a/lib/site_settings/type_supervisor.rb+++ b/lib/site_settings/type_supervisor.rb@@ -146,7 +146,7 @@ class SiteSettings::TypeSupervisor@static_types[name] = type.to_symif type.to_sym == :list- @allow_any[name] = opts[:allow_any] == false ? false : true+ @allow_any[name] = opts[:allow_any] != false@list_type[name] = opts[:list_type] if opts[:list_type]enddiff --git a/lib/topic_view.rb b/lib/topic_view.rbindex 58c55d24958..ad9ce02d46e 100644--- a/lib/topic_view.rb+++ b/lib/topic_view.rb@@ -140,7 +140,7 @@ class TopicView@message_bus_last_id = MessageBus.last_id("/topic/#{@topic.id}")- options.each { |key, value| self.instance_variable_set("@#{key}".to_sym, value) }+ options.each { |key, value| self.instance_variable_set(:"@#{key}", value) }@post_number = [@post_number.to_i, 1].maxdiff --git a/lib/topics_filter.rb b/lib/topics_filter.rbindex f39c7e8ce87..b8128c6cee7 100644--- a/lib/topics_filter.rb+++ b/lib/topics_filter.rb@@ -939,12 +939,7 @@ class TopicsFiltervalue.scan(/\A(?<tag_names>([\p{N}\p{L}\-_.]+)(?<delimiter>[,+])?([\p{N}\p{L}\-_.]+)?(\k<delimiter>[\p{N}\p{L}\-_.]+)*)\z/,) do |tag_names, delimiter|- match_all =- if delimiter == ","- false- else- true- end+ match_all = delimiter != ","tags = tag_names.split(delimiter)tag_ids = tag_ids_from_tag_names(tags)diff --git a/migrations/lib/converters/base/step.rb b/migrations/lib/converters/base/step.rbindex e234ddccab9..c04be463ba3 100644--- a/migrations/lib/converters/base/step.rb+++ b/migrations/lib/converters/base/step.rb@@ -17,7 +17,7 @@ module Migrations@tracker = trackerargs.each do |arg, value|- setter = "#{arg}=".to_sym+ setter = :"#{arg}="public_send(setter, value) if respond_to?(setter, true)endenddiff --git a/migrations/lib/importer/discourse_db.rb b/migrations/lib/importer/discourse_db.rbindex e1324a78907..94a2b8f6f48 100644--- a/migrations/lib/importer/discourse_db.rb+++ b/migrations/lib/importer/discourse_db.rb@@ -6,7 +6,7 @@ module MigrationsQueryResult = Data.define(:rows, :column_count)COPY_BATCH_SIZE = 1_000- SKIP_ROW_MARKER = :"$skip"+ SKIP_ROW_MARKER = :$skipdef initialize@encoder = PG::TextEncoder::CopyRow.newdiff --git a/migrations/lib/importer/steps/groups/groups.rb b/migrations/lib/importer/steps/groups/groups.rbindex 87d85f6f80c..06d831cf2d9 100644--- a/migrations/lib/importer/steps/groups/groups.rb+++ b/migrations/lib/importer/steps/groups/groups.rb@@ -11,8 +11,8 @@ module MigrationsALIAS_LEVELS = Group::ALIAS_LEVELS.values.to_set.freezeTRUST_LEVELS = TrustLevel.levels.values.to_set.freezeNOTIFICATION_LEVELS = GroupUser.notification_levels.values.to_set.freeze- DOMAIN_PROTOCOL_REGEX = %r{\Ahttps?://}.freeze- DOMAIN_PATH_REGEX = %r{/.*\z}.freeze+ DOMAIN_PROTOCOL_REGEX = %r{\Ahttps?://}+ DOMAIN_PATH_REGEX = %r{/.*\z}MAX_FULL_NAME_LENGTH = 100MAX_MEMBER_REQUEST_TEMPLATE_LENGTH = 5_000diff --git a/plugins/chat/db/post_migrate/20260430172653_remove_duplicate_chat_mention_notifications.rb b/plugins/chat/db/post_migrate/20260430172653_remove_duplicate_chat_mention_notifications.rbindex a6ab459d3ac..74b7c31be23 100644--- a/plugins/chat/db/post_migrate/20260430172653_remove_duplicate_chat_mention_notifications.rb+++ b/plugins/chat/db/post_migrate/20260430172653_remove_duplicate_chat_mention_notifications.rb@@ -14,7 +14,7 @@ class RemoveDuplicateChatMentionNotifications < ActiveRecord::Migration[8.0]# retry inserted another `Notification` row for the same mention. The# follow-up fix landed on 2026-04-30; this sweeps up rows created in# between.- WINDOW_START = "2026-04-29".freeze+ WINDOW_START = "2026-04-29"def upaffected_user_ids = DB.query_single(<<~SQL, type: CHAT_MENTION_TYPE, since: WINDOW_START)diff --git a/plugins/chat/spec/plugin_helper.rb b/plugins/chat/spec/plugin_helper.rbindex 98f324a48a3..02275d0f309 100644--- a/plugins/chat/spec/plugin_helper.rb+++ b/plugins/chat/spec/plugin_helper.rb@@ -24,7 +24,7 @@ module ChatSystemHelpersuser.activateuser.user_option.update!(chat_enabled: true)Group.refresh_automatic_group!(:trust_level_0)- Group.refresh_automatic_group!("trust_level_#{user.trust_level}".to_sym)+ Group.refresh_automatic_group!(:"trust_level_#{user.trust_level}")channel.add(user)enddiff --git a/plugins/chat/spec/queries/chat/thread_participant_query_spec.rb b/plugins/chat/spec/queries/chat/thread_participant_query_spec.rbindex ef13783bf18..7b996d611af 100644--- a/plugins/chat/spec/queries/chat/thread_participant_query_spec.rb+++ b/plugins/chat/spec/queries/chat/thread_participant_query_spec.rb@@ -106,13 +106,13 @@ RSpec.describe Chat::ThreadParticipantQuery docontext "when using preview false" do1..9.times do |i|- user = "user_#{i}".to_sym+ user = :"user_#{i}"fab!(user) { Fabricate(:user) }endbefore do1..9.times do |i|- user = "user_#{i}".to_sym+ user = :"user_#{i}"thread_3.add(public_send(user))Fabricate(:chat_message, thread: thread_3, user: public_send(user))enddiff --git a/plugins/discourse-ai/lib/completions/anthropic_message_processor.rb b/plugins/discourse-ai/lib/completions/anthropic_message_processor.rbindex cdf1fd0877e..8452a164567 100644--- a/plugins/discourse-ai/lib/completions/anthropic_message_processor.rb+++ b/plugins/discourse-ai/lib/completions/anthropic_message_processor.rb@@ -146,7 +146,7 @@ class DiscourseAi::Completions::AnthropicMessageProcessorparsed.dig(:usage, :output_tokens) || parsed.dig(:delta, :usage, :output_tokens)elsif parsed[:type] == "message_stop"# bedrock has this ...- if bedrock_stats = parsed.dig("amazon-bedrock-invocationMetrics".to_sym)+ if bedrock_stats = parsed.dig(:"amazon-bedrock-invocationMetrics")@input_tokens = bedrock_stats[:inputTokenCount] || @input_tokens@output_tokens = bedrock_stats[:outputTokenCount] || @output_tokensenddiff --git a/plugins/discourse-ai/spec/lib/agents/tools/mcp_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/mcp_spec.rbindex 650b00b04df..e53102cf5af 100644--- a/plugins/discourse-ai/spec/lib/agents/tools/mcp_spec.rb+++ b/plugins/discourse-ai/spec/lib/agents/tools/mcp_spec.rb@@ -108,7 +108,7 @@ RSpec.describe DiscourseAi::Agents::Tools::Mcp doexpect(schema[:properties][:combined][:required]).to eq(["b"])expect(schema[:required]).to eq(%w[places])- expect(schema).not_to have_key(:"$defs")+ expect(schema).not_to have_key(:$defs)endit "uses a short title in thinking summaries and renders the invocation parameters in details" dodiff --git a/plugins/discourse-calendar/spec/lib/discourse_post_event/event_parser_spec.rb b/plugins/discourse-calendar/spec/lib/discourse_post_event/event_parser_spec.rbindex 2268c165291..93e7ea6f519 100644--- a/plugins/discourse-calendar/spec/lib/discourse_post_event/event_parser_spec.rb+++ b/plugins/discourse-calendar/spec/lib/discourse_post_event/event_parser_spec.rb@@ -178,7 +178,7 @@ describe DiscoursePostEvent::EventParser doevents = parser.extract_events(post_event)expect(events[0][:"foo-bar"]).to eq("1")- expect(events[0][:"bar"]).to eq("2")+ expect(events[0][:bar]).to eq("2")endit "doesn’t parse not allowed custom fields" do@@ -188,7 +188,7 @@ describe DiscoursePostEvent::EventParser doTXTevents = parser.extract_events(post_event)- expect(events[0][:"baz"]).to eq(nil)+ expect(events[0][:baz]).to eq(nil)endendenddiff --git a/plugins/discourse-lazy-videos/lib/discourse_lazy_videos/crawler_post_end.rb b/plugins/discourse-lazy-videos/lib/discourse_lazy_videos/crawler_post_end.rbindex 2ea5ea870c1..607ff00b041 100644--- a/plugins/discourse-lazy-videos/lib/discourse_lazy_videos/crawler_post_end.rb+++ b/plugins/discourse-lazy-videos/lib/discourse_lazy_videos/crawler_post_end.rb@@ -5,7 +5,7 @@ module DiscourseLazyVideosattr_reader :controller, :postPROVIDER_NAMES = { "youtube" => "YouTube", "vimeo" => "Vimeo", "tiktok" => "TikTok" }.freeze- SCRIPT_ESCAPE_REGEX = %r{</script}i.freeze+ SCRIPT_ESCAPE_REGEX = %r{</script}iLAZY_VIDEO_CONTAINER = "lazy-video-container"def initialize(controller, post)diff --git a/plugins/discourse-patreon/plugin.rb b/plugins/discourse-patreon/plugin.rbindex 03098a1d4c5..44c1233b0d0 100644--- a/plugins/discourse-patreon/plugin.rb+++ b/plugins/discourse-patreon/plugin.rb@@ -83,7 +83,7 @@ after_initialize doPatreon::USER_DETAIL_FIELDS.each do |attribute|add_to_serializer(:admin_detailed_user,- "patreon_#{attribute}".to_sym,+ :"patreon_#{attribute}",include_condition: -> doPatreon::Patron.attr(attribute, object).present? &&(attribute != "amount_cents" || scope.is_admin?)diff --git a/plugins/poll/spec/integration/poll_endpoints_spec.rb b/plugins/poll/spec/integration/poll_endpoints_spec.rbindex baa523017ac..ebca79c3541 100644--- a/plugins/poll/spec/integration/poll_endpoints_spec.rb+++ b/plugins/poll/spec/integration/poll_endpoints_spec.rb@@ -261,7 +261,7 @@ RSpec.describe "DiscoursePoll endpoints" douser,post.id,DiscoursePoll::DEFAULT_POLL_NAME,- [user_votes["user_#{index}".to_sym]],+ [user_votes[:"user_#{index}"]],)DiscoursePoll::Poll.vote(user,@@ -396,7 +396,7 @@ RSpec.describe "DiscoursePoll endpoints" douser,private_post.id,DiscoursePoll::DEFAULT_POLL_NAME,- [user_votes["user_#{index}".to_sym]],+ [user_votes[:"user_#{index}"]],)UserCustomField.create(user_id: user.id,diff --git a/script/cache_critical_dns b/script/cache_critical_dnsindex fc2099c289e..2e38583ee4b 100755--- a/script/cache_critical_dns+++ b/script/cache_critical_dns@@ -326,39 +326,39 @@ HEALTH_CHECKS = Hash.new(# unknown keys (like services defined at runtime) are assumed to be healthylambda { |addr| true }).merge!({- "DISCOURSE_DB_HOST": lambda { |addr|+ DISCOURSE_DB_HOST: lambda { |addr|postgres_healthcheck(host: addr,user: ENV["DISCOURSE_DB_USERNAME"] || DEFAULT_DB_NAME,dbname: ENV["DISCOURSE_DB_NAME"] || DEFAULT_DB_NAME,port: ENV["DISCOURSE_DB_PORT"] || DEFAULT_DB_PORT,password: ENV["DISCOURSE_DB_PASSWORD"])},- "DISCOURSE_DB_REPLICA_HOST": lambda { |addr|+ DISCOURSE_DB_REPLICA_HOST: lambda { |addr|postgres_healthcheck(host: addr,user: ENV["DISCOURSE_DB_USERNAME"] || DEFAULT_DB_NAME,dbname: ENV["DISCOURSE_DB_NAME"] || DEFAULT_DB_NAME,port: ENV["DISCOURSE_DB_REPLICA_PORT"] || DEFAULT_DB_PORT,password: ENV["DISCOURSE_DB_PASSWORD"])},- "DISCOURSE_REDIS_HOST": lambda { |addr|+ DISCOURSE_REDIS_HOST: lambda { |addr|redis_healthcheck(host: addr,port: env_as_int("DISCOURSE_REDIS_PORT", DEFAULT_REDIS_PORT),username: ENV["DISCOURSE_REDIS_USERNAME"],password: ENV["DISCOURSE_REDIS_PASSWORD"])},- "DISCOURSE_REDIS_REPLICA_HOST": lambda { |addr|+ DISCOURSE_REDIS_REPLICA_HOST: lambda { |addr|redis_healthcheck(host: addr,port: env_as_int("DISCOURSE_REDIS_PORT", DEFAULT_REDIS_PORT),username: ENV["DISCOURSE_REDIS_USERNAME"],password: ENV["DISCOURSE_REDIS_PASSWORD"])},- "DISCOURSE_MESSAGE_BUS_REDIS_HOST": lambda { |addr|+ DISCOURSE_MESSAGE_BUS_REDIS_HOST: lambda { |addr|redis_healthcheck(host: addr,port: env_as_int("DISCOURSE_MESSAGE_BUS_REDIS_PORT", DEFAULT_REDIS_PORT),username: ENV["DISCOURSE_MESSAGE_BUS_REDIS_USERNAME"],password: ENV["DISCOURSE_MESSAGE_BUS_REDIS_PASSWORD"])},- "DISCOURSE_MESSAGE_BUS_REDIS_REPLICA_HOST": lambda { |addr|+ DISCOURSE_MESSAGE_BUS_REDIS_REPLICA_HOST: lambda { |addr|redis_healthcheck(host: addr,port: env_as_int("DISCOURSE_MESSAGE_BUS_REDIS_REPLICA_PORT", DEFAULT_REDIS_PORT),diff --git a/script/import_scripts/phpbb3/importers/user_importer.rb b/script/import_scripts/phpbb3/importers/user_importer.rbindex d363c1bef5d..9c9d24ce833 100644--- a/script/import_scripts/phpbb3/importers/user_importer.rb+++ b/script/import_scripts/phpbb3/importers/user_importer.rb@@ -117,7 +117,7 @@ module ImportScripts::PhpBB3begin@settings.custom_fields.map do |field|{- phpbb_field_name: "pf_#{field[:phpbb_field_name]}".to_sym,+ phpbb_field_name: :"pf_#{field[:phpbb_field_name]}",discourse_user_field: user_fields[field[:discourse_field_name]],}enddiff --git a/script/import_scripts/vanilla.rb b/script/import_scripts/vanilla.rbindex 519cb6a206b..b006587dbe7 100644--- a/script/import_scripts/vanilla.rb+++ b/script/import_scripts/vanilla.rb@@ -74,7 +74,7 @@ class ImportScripts::Vanilla < ImportScripts::BaseCSV.parse(data.join("\n"), headers: true, header_converters: :symbol).map { |row| row.to_hash }- instance_variable_set("@#{table}".to_sym, parsed_data)+ instance_variable_set(:"@#{table}", parsed_data)endendenddiff --git a/spec/lib/auth/google_oauth2_authenticator_spec.rb b/spec/lib/auth/google_oauth2_authenticator_spec.rbindex e0e5ed28ba7..64acb5e8bbb 100644--- a/spec/lib/auth/google_oauth2_authenticator_spec.rb+++ b/spec/lib/auth/google_oauth2_authenticator_spec.rb@@ -152,7 +152,7 @@ RSpec.describe Auth::GoogleOAuth2Authenticator doSiteSetting.google_oauth2_hd_groups_service_account_admin_email = "[email protected]"SiteSetting.google_oauth2_hd_groups_service_account_json = {"private_key" => private_key.to_s,- :"client_email" => "[email protected]",+ :client_email => "[email protected]",}.to_jsonSiteSetting.google_oauth2_hd_groups = true@@ -202,7 +202,7 @@ RSpec.describe Auth::GoogleOAuth2Authenticator doit "doesn't explode with invalid credentials" doSiteSetting.google_oauth2_hd_groups_service_account_json = {"private_key" => OpenSSL::PKey::RSA.generate(2048).to_s,- :"client_email" => "[email protected]",+ :client_email => "[email protected]",}.to_jsonresult = described_class.new.after_authenticate(@auth_hash)diff --git a/spec/lib/guardian_spec.rb b/spec/lib/guardian_spec.rbindex 480bc0b8080..c4299edc742 100644--- a/spec/lib/guardian_spec.rb+++ b/spec/lib/guardian_spec.rb@@ -193,7 +193,7 @@ RSpec.describe Guardian doit "respects the group's messageable_level" doGroup::ALIAS_LEVELS.each do |level, _|group.update!(messageable_level: Group::ALIAS_LEVELS[level])- user_output = level == :everyone ? true : false+ user_output = level == :everyoneadmin_output = level != :nobodymod_output = %i[nobody only_admins].exclude?(level)diff --git a/spec/lib/topics_filter_spec.rb b/spec/lib/topics_filter_spec.rbindex bd1e6509bb2..6e3207d4743 100644--- a/spec/lib/topics_filter_spec.rb+++ b/spec/lib/topics_filter_spec.rb@@ -455,7 +455,7 @@ RSpec.describe TopicsFilter doTopicUser.notification_levels.keys.each do |notification_level|describe "when query string is `in:#{notification_level}`" do- fab!("user_#{notification_level}_topic".to_sym) do+ fab!(:"user_#{notification_level}_topic") doFabricate(:topic).tap do |topic|TopicUser.change(user.id,diff --git a/spec/models/post_spec.rb b/spec/models/post_spec.rbindex fccec1f1f18..27d4ba7980f 100644--- a/spec/models/post_spec.rb+++ b/spec/models/post_spec.rb@@ -2528,7 +2528,7 @@ RSpec.describe Post doFabricate(:post_localization, post: post, locale: "zh_CN")expect(post.has_localization?(:zh_CN)).to eq(true)- expect(post.has_localization?(:"zh_CN")).to eq(true)+ expect(post.has_localization?(:zh_CN)).to eq(true)expect(post.has_localization?("zh-CN")).to eq(true)expect(post.has_localization?("z")).to eq(false)diff --git a/spec/models/topic_spec.rb b/spec/models/topic_spec.rbindex 40e96a86ea4..ef1eb69cd64 100644--- a/spec/models/topic_spec.rb+++ b/spec/models/topic_spec.rb@@ -3852,7 +3852,7 @@ RSpec.describe Topic doFabricate(:topic_localization, topic: topic, locale: "zh_CN")expect(topic.has_localization?(:zh_CN)).to eq(true)- expect(topic.has_localization?(:"zh_CN")).to eq(true)+ expect(topic.has_localization?(:zh_CN)).to eq(true)expect(topic.has_localization?("zh-CN")).to eq(true)expect(topic.has_localization?("z")).to eq(false)diff --git a/spec/requests/omniauth_callbacks_controller_spec.rb b/spec/requests/omniauth_callbacks_controller_spec.rbindex 8287aca0e2d..8aa26bcc7fd 100644--- a/spec/requests/omniauth_callbacks_controller_spec.rb+++ b/spec/requests/omniauth_callbacks_controller_spec.rb@@ -963,7 +963,7 @@ RSpec.describe Users::OmniauthCallbacksController doSiteSetting.google_oauth2_hd_groups_service_account_admin_email = "[email protected]"SiteSetting.google_oauth2_hd_groups_service_account_json = {"private_key" => private_key.to_s,- :"client_email" => "[email protected]",+ :client_email => "[email protected]",}.to_jsonSiteSetting.google_oauth2_hd_groups = truediff --git a/spec/requests/webhooks_controller_spec.rb b/spec/requests/webhooks_controller_spec.rbindex c3950e8ca90..210d3d2d033 100644--- a/spec/requests/webhooks_controller_spec.rb+++ b/spec/requests/webhooks_controller_spec.rb@@ -479,7 +479,7 @@ RSpec.describe WebhooksController do"msg" => {"email" => email,"diag" => "5.1.1",- :"bounce_description" =>+ :bounce_description =>"smtp; 550-5.1.1 The email account that you tried to reach does not exist.","metadata" => {"message_id" => message_id,@@ -796,10 +796,10 @@ RSpec.describe WebhooksController do"Type" => "Notification","Message" => {"notificationType" => "Bounce",- :"bounce" => {+ :bounce => {"bounceType" => "Permanent","reportingMTA" => "dns; email.example.com",- :"bouncedRecipients" => [+ :bouncedRecipients => [{"emailAddress" => email,"status" => "5.1.1",@@ -812,7 +812,7 @@ RSpec.describe WebhooksController do"feedbackId" => "00000138111222aa-33322211-cccc-cccc-cccc-ddddaaaa068a-000000","remoteMtaIp" => "127.0.2.0",},- :"mail" => {+ :mail => {"timestamp" => "2016-01-27T14:59:38.237Z","source" => "[email protected]","sourceArn" => "arn:aws:ses:us-east-1:888888888888:identity/example.com",