A platform for community discussion. Free, open, simple.
DEV: Fix `assigned but unused variable` Prism warnings (#39436)
Jarek Radosz683ae3f8b950
diff --git a/app/controllers/composer_messages_controller.rb b/app/controllers/composer_messages_controller.rbindex f3fffc7fd8e..2bb63db0e9a 100644--- a/app/controllers/composer_messages_controller.rb+++ b/app/controllers/composer_messages_controller.rb@@ -23,15 +23,6 @@ class ComposerMessagesController < ApplicationControllerusers = ComposerMessagesFinder.user_not_seen_in_a_while(usernames)user_count = users.count- if user_count > 0- message_locale =- if user_count == 1- "education.user_not_seen_in_a_while.single"- else- "education.user_not_seen_in_a_while.multiple"- end- end-json = {user_count: user_count,usernames: users,diff --git a/app/controllers/edit_directory_columns_controller.rb b/app/controllers/edit_directory_columns_controller.rbindex b373ef4cb9b..e981bc86c9c 100644--- a/app/controllers/edit_directory_columns_controller.rb+++ b/app/controllers/edit_directory_columns_controller.rb@@ -47,12 +47,11 @@ class EditDirectoryColumnsController < ApplicationControllerendend- details = {}-staff_action_logger.log_custom("update_directory_columns",{ previous_value: previous_values, new_value: new_values },)+render json: success_jsonenddiff --git a/app/controllers/metadata_controller.rb b/app/controllers/metadata_controller.rbindex 77a71ff8090..6a619f3afe0 100644--- a/app/controllers/metadata_controller.rb+++ b/app/controllers/metadata_controller.rb@@ -51,9 +51,6 @@ class MetadataController < ApplicationControllerendscheme_id = view_context.scheme_id- primary_color = ColorScheme.hex_for_name("primary", scheme_id)- icon_url_base =- UrlHelper.absolute("/svg-sprite/#{Discourse.current_hostname}/icon/#{primary_color}")manifest = {name: SiteSetting.title,diff --git a/app/controllers/topics_controller.rb b/app/controllers/topics_controller.rbindex c525460c695..203da4187d6 100644--- a/app/controllers/topics_controller.rb+++ b/app/controllers/topics_controller.rb@@ -1432,7 +1432,6 @@ class TopicsController < ApplicationControllerdef track_visit_to_topictopic_id = @topic_view.topic.id- ip = request.remote_ipuser_id = (current_user.id if current_user)if !request.format.json?diff --git a/app/jobs/regular/merge_user.rb b/app/jobs/regular/merge_user.rbindex abfb3d10ab6..4b5eb0468d3 100644--- a/app/jobs/regular/merge_user.rb+++ b/app/jobs/regular/merge_user.rb@@ -3,9 +3,6 @@module Jobsclass MergeUser < ::Jobs::Basedef execute(args)- target_user_id = args[:target_user_id]- current_user_id = args[:current_user_id]-user = User.find_by(id: args[:user_id])target_user = User.find_by(id: args[:target_user_id])current_user = User.find_by(id: args[:current_user_id])diff --git a/app/jobs/scheduled/clean_up_unused_registered_user_api_key_clients.rb b/app/jobs/scheduled/clean_up_unused_registered_user_api_key_clients.rbindex 3626cefbdce..9bf92cf9445 100644--- a/app/jobs/scheduled/clean_up_unused_registered_user_api_key_clients.rb+++ b/app/jobs/scheduled/clean_up_unused_registered_user_api_key_clients.rb@@ -8,15 +8,14 @@ module Jobsif SiteSetting.unused_registered_user_api_key_clients_days > 0destroy_days_ago = SiteSetting.unused_registered_user_api_key_clients_days.days.ago- clients =- UserApiKeyClient- .where.not(auth_redirect: nil)- .where(- "id NOT IN (SELECT user_api_key_client_id FROM user_api_keys WHERE user_api_keys.last_used_at > ?)",- destroy_days_ago,- )- .distinct- .destroy_all+ UserApiKeyClient+ .where.not(auth_redirect: nil)+ .where(+ "id NOT IN (SELECT user_api_key_client_id FROM user_api_keys WHERE user_api_keys.last_used_at > ?)",+ destroy_days_ago,+ )+ .distinct+ .destroy_allendendenddiff --git a/app/models/concerns/has_custom_fields.rb b/app/models/concerns/has_custom_fields.rbindex b3b3121ad53..ed40890c955 100644--- a/app/models/concerns/has_custom_fields.rb+++ b/app/models/concerns/has_custom_fields.rb@@ -300,8 +300,6 @@ module HasCustomFieldsif descriptor.array_type? || (field_type != :json && Array === value)value = Array(value || [])value.compact!- sub_type = field_type[0]-value.map! { |v| descriptor.serialize(v) }unless value == fields.map(&:value)diff --git a/app/models/concerns/reports/time_to_first_response.rb b/app/models/concerns/reports/time_to_first_response.rbindex 3b419e1acbe..89fc9011500 100644--- a/app/models/concerns/reports/time_to_first_response.rb+++ b/app/models/concerns/reports/time_to_first_response.rb@@ -5,7 +5,6 @@ module Reports::TimeToFirstResponseclass_methods dodef report_time_to_first_response(report)- category_filter = report.filters.dig(:category)category_id, include_subcategories = report.add_category_filterreport.icon = "reply"diff --git a/app/models/group_archived_message.rb b/app/models/group_archived_message.rbindex 14de99ba753..b08495446a1 100644--- a/app/models/group_archived_message.rb+++ b/app/models/group_archived_message.rb@@ -6,10 +6,13 @@ class GroupArchivedMessage < ActiveRecord::Basedef self.move_to_inbox!(group_id, topic, opts = {})topic_id = topic.id- destroyed = GroupArchivedMessage.where(group_id: group_id, topic_id: topic_id).destroy_all++ GroupArchivedMessage.where(group_id: group_id, topic_id: topic_id).destroy_all+trigger(:move_to_inbox, group_id, topic_id)MessageBus.publish("/topic/#{topic_id}", { type: "move_to_inbox" }, group_ids: [group_id])publish_topic_tracking_state(topic, group_id, opts[:acting_user_id])+Jobs.enqueue(:group_pm_update_summary,group_id: group_id,@@ -20,11 +23,14 @@ class GroupArchivedMessage < ActiveRecord::Basedef self.archive!(group_id, topic, opts = {})topic_id = topic.id- destroyed = GroupArchivedMessage.where(group_id: group_id, topic_id: topic_id).destroy_all++ GroupArchivedMessage.where(group_id: group_id, topic_id: topic_id).destroy_allGroupArchivedMessage.create!(group_id: group_id, topic_id: topic_id)+trigger(:archive_message, group_id, topic_id)MessageBus.publish("/topic/#{topic_id}", { type: "archived" }, group_ids: [group_id])publish_topic_tracking_state(topic, group_id, opts[:acting_user_id])+Jobs.enqueue(:group_pm_update_summary,group_id: group_id,diff --git a/app/models/private_message_topic_tracking_state.rb b/app/models/private_message_topic_tracking_state.rbindex d50069b3182..5b9da537b54 100644--- a/app/models/private_message_topic_tracking_state.rb+++ b/app/models/private_message_topic_tracking_state.rb@@ -71,7 +71,7 @@ class PrivateMessageTopicTrackingStateTopicTrackingState.new_filter_sqlend- sql = +<<~SQL+ +<<~SQLSELECTDISTINCT topics.id AS topic_id,u.id AS user_id,diff --git a/app/models/topic_group.rb b/app/models/topic_group.rbindex 8a05b36a7e8..9ca08b116fd 100644--- a/app/models/topic_group.rb+++ b/app/models/topic_group.rb@@ -31,14 +31,13 @@ class TopicGroup < ActiveRecord::Basetg.group_idSQL- updated_groups =- DB.query(- update_query,- user_id: user.id,- topic_id: topic_id,- post_number: post_number,- now: DateTime.now,- )+ DB.query(+ update_query,+ user_id: user.id,+ topic_id: topic_id,+ post_number: post_number,+ now: DateTime.now,+ )enddef self.create_topic_group(user, topic_id, post_number, updated_group_ids)diff --git a/app/models/upload.rb b/app/models/upload.rbindex 0c09d16f928..6bb724abcf4 100644--- a/app/models/upload.rb+++ b/app/models/upload.rb@@ -421,7 +421,7 @@ class Upload < ActiveRecord::Baseraise "Calculated dominant color but unable to parse output:\n#{data}" if color.nil?color- rescue Discourse::Utils::CommandError => e+ rescue Discourse::Utils::CommandError# Timeout or unable to parse image# This can happen due to bad user input - ignore and save# an empty string to prevent re-evaluationdiff --git a/app/serializers/user_card_serializer.rb b/app/serializers/user_card_serializer.rbindex 6536cfa2c18..208c2aea209 100644--- a/app/serializers/user_card_serializer.rb+++ b/app/serializers/user_card_serializer.rb@@ -200,7 +200,7 @@ class UserCardSerializer < BasicUserSerializerenddef recent_time_read- time = object.recent_time_read+ object.recent_time_readenddef primary_group_namediff --git a/app/services/handle_chunk_upload.rb b/app/services/handle_chunk_upload.rbindex cc69c1c5baa..433e8791ff6 100644--- a/app/services/handle_chunk_upload.rb+++ b/app/services/handle_chunk_upload.rb@@ -23,7 +23,7 @@ class HandleChunkUploadhas_chunk_been_uploaded =File.exist?(@chunk) && File.size(@chunk) == @params[:current_chunk_size]# 200 = exists, 404 = not uploaded yet- status = has_chunk_been_uploaded ? 200 : 404+ has_chunk_been_uploaded ? 200 : 404enddef upload_chunkdiff --git a/app/services/user_updater.rb b/app/services/user_updater.rbindex 7ec8e4bbd66..f1cc14e1f98 100644--- a/app/services/user_updater.rb+++ b/app/services/user_updater.rb@@ -259,7 +259,7 @@ class UserUpdater)endDiscourseEvent.trigger(:within_user_updater_transaction, user, attributes)- rescue Addressable::URI::InvalidURIError => e+ rescue Addressable::URI::InvalidURIError# Prevent 500 for crazy url inputreturn savedenddiff --git a/config/initializers/000-pg_connection_patch.rb b/config/initializers/000-pg_connection_patch.rbindex bde7c786d15..aa97599e6fd 100644--- a/config/initializers/000-pg_connection_patch.rb+++ b/config/initializers/000-pg_connection_patch.rb@@ -2,7 +2,6 @@class ActiveRecord::ConnectionAdapters::PostgreSQLAdapterdef self.new_client(conn_params)- start = Time.now()PG.connect(**conn_params)rescue ::PG::Error => errorif conn_params && conn_params[:dbname] == "postgres"diff --git a/config/initializers/008-rack-cors.rb b/config/initializers/008-rack-cors.rbindex f9d23ec771d..bfd8422da9d 100644--- a/config/initializers/008-rack-cors.rb+++ b/config/initializers/008-rack-cors.rb@@ -32,15 +32,11 @@ class Discourse::Corsenddef self.apply_headers(cors_origins, env, headers)- request_method = env["REQUEST_METHOD"]-if headers["Access-Control-Allow-Origin"]# Already configured. Probably by ApplicationController#apply_cdn_headerselsif cors_origins- origin = nil- if origin = env["HTTP_ORIGIN"]- origin = nil if cors_origins.exclude?(origin)- end+ origin = env["HTTP_ORIGIN"]+ origin = nil if origin && cors_origins.exclude?(origin)headers["Access-Control-Allow-Origin"] = origin || cors_origins[0]headers[diff --git a/lib/backup_restore/restorer.rb b/lib/backup_restore/restorer.rbindex eb6218f60d4..473df6c78c7 100644--- a/lib/backup_restore/restorer.rb+++ b/lib/backup_restore/restorer.rb@@ -187,7 +187,7 @@ module BackupRestorestatus = @success ? :restore_succeeded : :restore_failedlogs = Discourse::Utils.logs_markdown(@logger.logs, user: user)- post = SystemMessage.create_from_system_user(user, status, logs: logs)+ SystemMessage.create_from_system_user(user, status, logs: logs)elselog "Could not send notification to '#{@user_info[:username]}' " \"(#{@user_info[:email]}), because the user does not exist."diff --git a/lib/discourse_dev/email_log.rb b/lib/discourse_dev/email_log.rbindex b7d94c27090..961d94bd137 100644--- a/lib/discourse_dev/email_log.rb+++ b/lib/discourse_dev/email_log.rb@@ -47,7 +47,6 @@ module DiscourseDevdef incoming_email_datauser = User.random- subject = Faker::Lorem.sentenceemail_content = <<-EMAILReturn-Path: #{user.email}From: #{user.email}diff --git a/lib/discourse_dev/tag.rb b/lib/discourse_dev/tag.rbindex 96c06ad6e1d..17b9a0688dc 100644--- a/lib/discourse_dev/tag.rb+++ b/lib/discourse_dev/tag.rb@@ -12,7 +12,7 @@ module DiscourseDevdef create!super- rescue ActiveRecord::RecordInvalid => e+ rescue ActiveRecord::RecordInvalid# If the name is taken, try againretryenddiff --git a/lib/discourse_webauthn/registration_service.rb b/lib/discourse_webauthn/registration_service.rbindex 3fb339bb831..a0bf30e7be9 100644--- a/lib/discourse_webauthn/registration_service.rb+++ b/lib/discourse_webauthn/registration_service.rb@@ -154,7 +154,7 @@ module DiscourseWebauthn# see https://w3c.github.io/webauthn/#attested-credential-data for lengths# of data for extraction- aa_guid = attested_credential_data[0..15]+ # aa_guid = attested_credential_data[0..15]credential_id_length = attested_credential_data[16..17].unpack("n*")[0]credential_id = attested_credential_data[18..(18 + credential_id_length - 1)]diff --git a/lib/file_store/s3_store.rb b/lib/file_store/s3_store.rbindex 2c366972344..0cf1e89a3a7 100644--- a/lib/file_store/s3_store.rb+++ b/lib/file_store/s3_store.rb@@ -505,7 +505,7 @@ module FileStoreif acl.present? || remove_existing_aclbegin- object = object_from_path(key).acl.put(acl:)+ object_from_path(key).acl.put(acl:)rescue Aws::S3::Errors::NotImplemented => errDiscourse.warn_exception(err,diff --git a/lib/gaps.rb b/lib/gaps.rbindex 517f1e99c92..78a0beb7aba 100644--- a/lib/gaps.rb+++ b/lib/gaps.rb@@ -27,7 +27,6 @@ class Gapsreturn if @subset.nil? || @original.nil?i = j = 0- gaps = {}current_gap = []while e1 = @subset[i]diff --git a/lib/import_export/base_exporter.rb b/lib/import_export/base_exporter.rbindex 6f08abfa297..a5169b92fcd 100644--- a/lib/import_export/base_exporter.rb+++ b/lib/import_export/base_exporter.rb@@ -122,7 +122,6 @@ module ImportExportenddef export_category_groups- groups = []group_names = []auto_group_names = Group::AUTO_GROUPS.keys.map(&:to_s)diff --git a/lib/import_export/importer.rb b/lib/import_export/importer.rbindex 67c1b00d80a..550a9b66f4c 100644--- a/lib/import_export/importer.rb+++ b/lib/import_export/importer.rb@@ -62,8 +62,9 @@ module ImportExport@groups.each do |group_data|g = group_data.dupuser_ids = g.delete(:user_ids)- external_id = g.delete(:id)+ g.delete(:id) # external_idnew_group = Group.find_by_name(g[:name]) || Group.create!(g)+user_ids.each do |external_user_id|beginnew_group.add(User.find(new_user_id(external_user_id)))diff --git a/lib/mini_scheduler_long_running_job_logger.rb b/lib/mini_scheduler_long_running_job_logger.rbindex f64d70800f8..0685f4930b2 100644--- a/lib/mini_scheduler_long_running_job_logger.rb+++ b/lib/mini_scheduler_long_running_job_logger.rb@@ -24,8 +24,6 @@ class MiniSchedulerLongRunningJobLoggerdef start@thread ||=Thread.new do- hostname = Discourse.os_hostname-loop dobreak if self.stop_requested?diff --git a/lib/onebox/status_check.rb b/lib/onebox/status_check.rbindex b774232ff8c..6c98b4e6e79 100644--- a/lib/onebox/status_check.rb+++ b/lib/onebox/status_check.rb@@ -35,7 +35,7 @@ module Oneboxprivatedef check- status, headers = FinalDestination.new(@url).small_get({})+ status, _headers = FinalDestination.new(@url).small_get({})@status = statusrescue Timeout::Error, Errno::ECONNREFUSED, Net::HTTPError, SocketError@status = 0diff --git a/lib/pretty_text/helpers.rb b/lib/pretty_text/helpers.rbindex 2f38fae3905..81cef0386eb 100644--- a/lib/pretty_text/helpers.rb+++ b/lib/pretty_text/helpers.rb@@ -64,9 +64,9 @@ module PrettyTextUpload.where(sha1: map.values)- .pluck(:sha1, :url, :extension, :original_filename, :secure)+ .pluck(:sha1, :url, :extension, :secure).each do |row|- sha1, url, extension, original_filename, secure = row+ sha1, url, extension, secure = rowif short_urls = reverse_map[sha1]secure_uploads = SiteSetting.secure_uploads? && securediff --git a/lib/site_settings/type_supervisor.rb b/lib/site_settings/type_supervisor.rbindex b4a146898ac..0929f8f14f4 100644--- a/lib/site_settings/type_supervisor.rb+++ b/lib/site_settings/type_supervisor.rb@@ -215,7 +215,6 @@ class SiteSettings::TypeSupervisordef type_hash(name)name = name.to_symtype = get_type(name)- list_type = get_list_type(name)result = { type: type.to_s }if type == :enum || (type == :list && get_enum_class(name))diff --git a/lib/tasks/populate.thor b/lib/tasks/populate.thorindex 422de72ba4f..85e66a749a8 100644--- a/lib/tasks/populate.thor+++ b/lib/tasks/populate.thor@@ -98,9 +98,8 @@ class Populate < Thorputs post_creator.errors.full_messages, ""raise StandardError.new(post_creator.errors.full_messages)end- topic = first_post.topic- start_post = 2- topic++ first_post.topicenddef create_post(users, topic)diff --git a/lib/tasks/themes.rake b/lib/tasks/themes.rakeindex d1e22d8de08..6011886dcdc 100644--- a/lib/tasks/themes.rake+++ b/lib/tasks/themes.rake@@ -227,22 +227,21 @@ task "themes:clone_all_official" do |task, args|require "theme_metadata"FileUtils.rm_rf("tmp/themes")- official_themes =- ThemeMetadata::OFFICIAL_THEMES.each do |theme_name|- repo = "https://github.com/discourse/#{theme_name}"- path = File.join(Rails.root, "tmp/themes/#{theme_name}")+ ThemeMetadata::OFFICIAL_THEMES.each do |theme_name|+ repo = "https://github.com/discourse/#{theme_name}"+ path = File.join(Rails.root, "tmp/themes/#{theme_name}")- attempts = 0+ attempts = 0- begin- attempts += 1- system("git clone #{repo} #{path}", exception: true)- rescue StandardError- abort("Failed to clone #{repo}") if attempts >= 3- STDERR.puts "Failed to clone #{repo}... trying again..."- retry- end+ begin+ attempts += 1+ system("git clone #{repo} #{path}", exception: true)+ rescue StandardError+ abort("Failed to clone #{repo}") if attempts >= 3+ STDERR.puts "Failed to clone #{repo}... trying again..."+ retryend+ endenddesc "pull compatible theme versions for all themes"diff --git a/lib/tasks/uploads.rake b/lib/tasks/uploads.rakeindex 2092aca4b6b..83b171f6d1a 100644--- a/lib/tasks/uploads.rake+++ b/lib/tasks/uploads.rake@@ -870,7 +870,6 @@ enddef mark_upload_posts_for_rebake(post_ids_to_rebake)posts_to_rebake = Post.where(id: post_ids_to_rebake)- post_rebake_errors = []puts "","Marking #{posts_to_rebake.length} posts with affected uploads for rebake. Every 15 minutes, a batch of these will be enqueued for rebaking.",""diff --git a/lib/theme_store/git_importer.rb b/lib/theme_store/git_importer.rbindex 3b734fdbd35..773482b774f 100644--- a/lib/theme_store/git_importer.rb+++ b/lib/theme_store/git_importer.rb@@ -17,7 +17,7 @@ class ThemeStore::GitImporter < ThemeStore::BaseImporterif version = Discourse.find_compatible_git_resource(temp_folder)beginexecute "git", "cat-file", "-e", version- rescue RuntimeError => e+ rescue RuntimeErrortracking_ref =execute "git", "rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{upstream}"remote_name = tracking_ref.split("/", 2)[0]diff --git a/lib/theme_translation_manager.rb b/lib/theme_translation_manager.rbindex e9b354ddd03..31a171982f4 100644--- a/lib/theme_translation_manager.rb+++ b/lib/theme_translation_manager.rb@@ -5,7 +5,6 @@ class ThemeTranslationManagerattr_reader :key, :default, :themedef self.list_from_hash(locale:, hash:, theme:, parent_keys: [])- list = []hash.map do |key, value|this_key_array = parent_keys + [key]@@ -61,12 +60,11 @@ class ThemeTranslationManagerenddef create_record!(value)- record =- ThemeTranslationOverride.create!(- locale: @locale,- translation_key: @key,- theme: @theme,- value: value,- )+ ThemeTranslationOverride.create!(+ locale: @locale,+ translation_key: @key,+ theme: @theme,+ value: value,+ )endenddiff --git a/lib/topic_creator.rb b/lib/topic_creator.rbindex 72d9288457a..cffceb9ecf5 100644--- a/lib/topic_creator.rb+++ b/lib/topic_creator.rb@@ -124,7 +124,7 @@ class TopicCreatorbegingroup.set_message_default_notification_levels!(topic)- rescue Group::GroupPmUserLimitExceededError => e+ rescue Group::GroupPmUserLimitExceededErrorrollback_with!(topic,:too_large_group,diff --git a/lib/turbo_tests/runner.rb b/lib/turbo_tests/runner.rbindex 9f40978845a..806b64923cb 100644--- a/lib/turbo_tests/runner.rb+++ b/lib/turbo_tests/runner.rb@@ -105,21 +105,11 @@ module TurboTestsprotecteddef check_for_migrations- config =- ActiveRecord::Base- .configurations- .find_db_config("test")- .configuration_hash- .merge("database" => "discourse_test_1")-ActiveRecord::Tasks::DatabaseTasks.migrations_paths = %w[db/migrate db/post_migrate]-- begin- ActiveRecord::Migration.check_all_pending!- rescue ActiveRecord::PendingMigrationError- puts "There are pending migrations, run rake parallel:migrate"- exit 1- end+ ActiveRecord::Migration.check_all_pending!+ rescue ActiveRecord::PendingMigrationError+ STDERR.puts "There are pending migrations, run rake parallel:migrate"+ exit 1enddef setup_tmp_dirdiff --git a/lib/validators/pop3_polling_enabled_setting_validator.rb b/lib/validators/pop3_polling_enabled_setting_validator.rbindex d56f5ae6d82..223c19c0041 100644--- a/lib/validators/pop3_polling_enabled_setting_validator.rb+++ b/lib/validators/pop3_polling_enabled_setting_validator.rb@@ -40,7 +40,7 @@ class POP3PollingEnabledSettingValidatorpassword: SiteSetting.pop3_polling_password,openssl_verify: SiteSetting.pop3_polling_openssl_verify,)- rescue *EmailSettingsExceptionHandler::EXPECTED_EXCEPTIONS => err+ rescue *EmailSettingsExceptionHandler::EXPECTED_EXCEPTIONSfalseelsetruediff --git a/lib/validators/string_setting_validator.rb b/lib/validators/string_setting_validator.rbindex 7dcc6abd229..2b218b90d00 100644--- a/lib/validators/string_setting_validator.rb+++ b/lib/validators/string_setting_validator.rb@@ -27,7 +27,7 @@ class StringSettingValidator# but ideally we should validate against the schemabeginJSON.parse(json)- rescue JSON::ParserError => e+ rescue JSON::ParserError@json_fail = truereturn falseenddiff --git a/lib/version_compatibility.rb b/lib/version_compatibility.rbindex a0710470bda..226bf2e0bef 100644--- a/lib/version_compatibility.rb+++ b/lib/version_compatibility.rb@@ -26,7 +26,7 @@ module Discoursebeginversion_list = YAML.safe_load(version_list)- rescue Psych::SyntaxError, Psych::DisallowedClass => e+ rescue Psych::SyntaxError, Psych::DisallowedClassendraise InvalidVersionListError unless version_list.is_a?(Hash)@@ -35,7 +35,7 @@ module Discourseversion_list.transform_keys do |v|Gem::Requirement.parse(v)- rescue Gem::Requirement::BadRequirementError => e+ rescue Gem::Requirement::BadRequirementErrorraise InvalidVersionListError, "Invalid version specifier: #{v}"end.sort_by do |parsed_requirement, _|@@ -129,7 +129,7 @@ module Discourse)Discourse.find_compatible_resource(compat_resource)- rescue InvalidVersionListError => e+ rescue InvalidVersionListError$stderr.puts "Invalid version list in #{path}"rescue Discourse::Utils::CommandErrorenddiff --git a/plugins/chat/lib/chat/onebox_handler.rb b/plugins/chat/lib/chat/onebox_handler.rbindex d9a5020b698..9803fecc436 100644--- a/plugins/chat/lib/chat/onebox_handler.rb+++ b/plugins/chat/lib/chat/onebox_handler.rb@@ -37,7 +37,7 @@ module Chatprivatedef self.build_args(url, chat_channel)- args = {+ {channel_id: chat_channel.id,channel_name: chat_channel.name,is_category: chat_channel.category_channel?,diff --git a/plugins/discourse-ai/lib/configuration/embedding_defs_validator.rb b/plugins/discourse-ai/lib/configuration/embedding_defs_validator.rbindex 06cd00b777f..84b1c821e84 100644--- a/plugins/discourse-ai/lib/configuration/embedding_defs_validator.rb+++ b/plugins/discourse-ai/lib/configuration/embedding_defs_validator.rb@@ -25,7 +25,7 @@ module DiscourseAiendtrue- rescue Net::HTTPBadResponse => e+ rescue Net::HTTPBadResponsefalseenddiff --git a/plugins/discourse-ai/lib/guardian_extensions.rb b/plugins/discourse-ai/lib/guardian_extensions.rbindex e2aaf0303ed..2b857b96858 100644--- a/plugins/discourse-ai/lib/guardian_extensions.rb+++ b/plugins/discourse-ai/lib/guardian_extensions.rb@@ -53,7 +53,6 @@ module DiscourseAidef can_request_summary?return false if anonymous?- user_group_ids = user.group_idsif (ai_agent = AiAgent.find_by_id_from_cache(SiteSetting.ai_summarization_agent)).blank?return falseenddiff --git a/plugins/discourse-ai/lib/inferred_concepts/applier.rb b/plugins/discourse-ai/lib/inferred_concepts/applier.rbindex 9c7270ca533..31241d244b5 100644--- a/plugins/discourse-ai/lib/inferred_concepts/applier.rb+++ b/plugins/discourse-ai/lib/inferred_concepts/applier.rb@@ -99,9 +99,6 @@ module DiscourseAidef match_concepts_to_content(content, concept_list)return [] if content.blank? || concept_list.blank?- # Prepare user message with only the content- user_message = content-# Use the ConceptMatcher agent to match conceptsagent =diff --git a/plugins/discourse-ai/lib/summarization/strategies/topic_summary.rb b/plugins/discourse-ai/lib/summarization/strategies/topic_summary.rbindex fa8c9c10721..afbebdfcb1b 100644--- a/plugins/discourse-ai/lib/summarization/strategies/topic_summary.rb+++ b/plugins/discourse-ai/lib/summarization/strategies/topic_summary.rb@@ -48,7 +48,6 @@ module DiscourseAienddef as_llm_messages(contents)- resource_path = "#{Discourse.base_path}/t/-/#{target.id}"content_title = target.titlecategory_name = target.category&.name# Only include public tags in summaries since summaries are cached and shared across usersdiff --git a/plugins/discourse-calendar/lib/time_sniffer.rb b/plugins/discourse-calendar/lib/time_sniffer.rbindex 5be385ed0d4..a61f2e13b35 100644--- a/plugins/discourse-calendar/lib/time_sniffer.rb+++ b/plugins/discourse-calendar/lib/time_sniffer.rb@@ -302,7 +302,7 @@ class TimeSnifferif matchbeginresult = instance_exec(match, &blk)- rescue Exception => e+ rescue Exceptionraise if @raise_errorselsereturn result if resultdiff --git a/plugins/discourse-chat-integration/app/jobs/onceoff/migrate_from_slack_official.rb b/plugins/discourse-chat-integration/app/jobs/onceoff/migrate_from_slack_official.rbindex 2a36a68f8c8..c12292a2621 100644--- a/plugins/discourse-chat-integration/app/jobs/onceoff/migrate_from_slack_official.rb+++ b/plugins/discourse-chat-integration/app/jobs/onceoff/migrate_from_slack_official.rb@@ -86,13 +86,12 @@ module Jobsend# Create the rule, with clever logic for avoiding duplicates- success =- DiscourseChatIntegration::Helper.smart_create_rule(- channel: channel,- filter: row[:filter],- category_id: row[:category_id],- tags: row[:tags],- )+ DiscourseChatIntegration::Helper.smart_create_rule(+ channel: channel,+ filter: row[:filter],+ category_id: row[:category_id],+ tags: row[:tags],+ )endenddiff --git a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/guilded/guilded_provider.rb b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/guilded/guilded_provider.rbindex 59da14a8b74..9eff936b3d0 100644--- a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/guilded/guilded_provider.rb+++ b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/guilded/guilded_provider.rb@@ -35,23 +35,15 @@ module DiscourseChatIntegrationdef self.generate_guilded_message(post)topic = post.topic- category = ""- if topic.category- category =- (- if (topic.category.parent_category)- "[#{topic.category.parent_category.name}/#{topic.category.name}]"- else- "[#{topic.category.name}]"- end- )- end- display_name = DiscourseChatIntegration::Helper.formatted_display_name(post.user)-- icon_url =- if (url = (SiteSetting.try(:site_logo_small_url) || SiteSetting.logo_small_url)).present?- "#{Discourse.base_url}#{url}"+ category =+ if topic.category&.parent_category+ "[#{topic.category.parent_category.name}/#{topic.category.name}]"+ elsif topic.category+ "[#{topic.category.name}]"+ else+ ""end+ display_name = DiscourseChatIntegration::Helper.formatted_display_name(post.user)message = {embeds: [diff --git a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/zulip/zulip_provider.rb b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/zulip/zulip_provider.rbindex e871ae4089e..d8df4a9f84b 100644--- a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/zulip/zulip_provider.rb+++ b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/zulip/zulip_provider.rb@@ -48,7 +48,7 @@ module DiscourseChatIntegration),)- data = { type: "stream", to: stream, subject: subject, content: message }+ { type: "stream", to: stream, subject: subject, content: message }enddef self.trigger_notification(post, channel, rule)diff --git a/plugins/discourse-lti/lib/discourse_lti/lti_omniauth_strategy.rb b/plugins/discourse-lti/lib/discourse_lti/lti_omniauth_strategy.rbindex 126c025e0de..dd1b74baaf6 100644--- a/plugins/discourse-lti/lib/discourse_lti/lti_omniauth_strategy.rb+++ b/plugins/discourse-lti/lib/discourse_lti/lti_omniauth_strategy.rb@@ -34,7 +34,6 @@ class DiscourseLti::LtiOmniauthStrategyenddef other_phase- methods = %i[get post]if on_initiate_path? && %i[get post].include?(request.request_method.downcase.to_sym)return initiate_phaseend@@ -220,7 +219,7 @@ class DiscourseLti::LtiOmniauthStrategyenddef decode_token(token)- payload, header =+ payload, _header =::JWT.decode(request.params["id_token"],public_key,diff --git a/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/base.rb b/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/base.rbindex 8aceb4f6fb2..1b29dbf5316 100644--- a/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/base.rb+++ b/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/base.rb@@ -154,7 +154,6 @@ module DiscourseNarrativeBotenddef reset_data(user, additional_data = {})- old_data = get_data(user)new_data = additional_dataset_data(user, new_data)new_datadiff --git a/plugins/discourse-post-voting/lib/post_voting/comment_review_queue.rb b/plugins/discourse-post-voting/lib/post_voting/comment_review_queue.rbindex a059c8e479d..265da5630dc 100644--- a/plugins/discourse-post-voting/lib/post_voting/comment_review_queue.rb+++ b/plugins/discourse-post-voting/lib/post_voting/comment_review_queue.rb@@ -43,15 +43,14 @@ module PostVotingpayload: payload,)reviewable.update(target_created_by: comment.user)- score =- reviewable.add_score(- guardian.user,- flag_type_id,- meta_topic_id: post&.topic_id,- take_action: opts[:take_action],- reason: queued_for_review ? "post_voting_comment_queued_by_staff" : nil,- force_review: queued_for_review,- )+ reviewable.add_score(+ guardian.user,+ flag_type_id,+ meta_topic_id: post&.topic_id,+ take_action: opts[:take_action],+ reason: queued_for_review ? "post_voting_comment_queued_by_staff" : nil,+ force_review: queued_for_review,+ )if opts[:take_action]reviewable.perform(guardian.user, :agree_and_delete)diff --git a/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/admin/subscriptions_controller.rb b/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/admin/subscriptions_controller.rbindex 5132944c4e4..3e16a81b516 100644--- a/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/admin/subscriptions_controller.rb+++ b/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/admin/subscriptions_controller.rb@@ -100,7 +100,8 @@ module DiscourseSubscriptionsstripe_request_opts,) if subscription[:latest_invoice]payment_intent = invoice[:payment_intent] if invoice[:payment_intent]- refund = ::Stripe::Refund.create({ payment_intent: payment_intent }, stripe_request_opts)++ ::Stripe::Refund.create({ payment_intent: payment_intent }, stripe_request_opts)endendenddiff --git a/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/subscribe_controller.rb b/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/subscribe_controller.rbindex 57fdecf230f..4799a361161 100644--- a/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/subscribe_controller.rb+++ b/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/subscribe_controller.rb@@ -111,16 +111,16 @@ module DiscourseSubscriptionsendinvoice = ::Stripe::Invoice.create(invoice_params, stripe_request_opts)- invoice_item =- ::Stripe::InvoiceItem.create(- {- customer: customer[:id],- price: params[:plan],- discounts: [{ coupon: coupon_id }],- invoice: invoice[:id],- },- stripe_request_opts,- )+ ::Stripe::InvoiceItem.create(+ {+ customer: customer[:id],+ price: params[:plan],+ discounts: [{ coupon: coupon_id }],+ invoice: invoice[:id],+ },+ stripe_request_opts,+ )+transaction = ::Stripe::Invoice.finalize_invoice(invoice[:id], {}, stripe_request_opts)payment_intent = retrieve_payment_intent(transaction[:id]) if transaction[:status] =="open"diff --git a/plugins/discourse-subscriptions/app/services/discourse_subscriptions/campaign.rb b/plugins/discourse-subscriptions/app/services/discourse_subscriptions/campaign.rbindex 68fd63f723f..0d250c34fbf 100644--- a/plugins/discourse-subscriptions/app/services/discourse_subscriptions/campaign.rb+++ b/plugins/discourse-subscriptions/app/services/discourse_subscriptions/campaign.rb@@ -138,7 +138,7 @@ module DiscourseSubscriptions},}- plan = ::Stripe::Price.create(price_object, stripe_request_opts)+ ::Stripe::Price.create(price_object, stripe_request_opts)enddef get_one_time_payments(product_ids)diff --git a/spec/rails_helper.rb b/spec/rails_helper.rbindex 949002cbe6a..5b4ba867e97 100644--- a/spec/rails_helper.rb+++ b/spec/rails_helper.rb@@ -437,7 +437,7 @@ RSpec.configure do |config|module IgnoreServerCapturedErrorsdef raise_server_error!super- rescue EOFError, Errno::ECONNRESET, Errno::EPIPE, Errno::ENOTCONN => e+ rescue EOFError, Errno::ECONNRESET, Errno::EPIPE, Errno::ENOTCONN# Ignore these exceptions - caused by client. Handled by the app server in dev/prodendend@@ -497,7 +497,6 @@ RSpec.configure do |config|example_file_path = example.metadata[:rerun_file_path]if example_file_path- expanded_example_file_path = Pathname.new(example_file_path).expand_pathmatch =example_file_path.to_s.match(%r{^#{Regexp.escape(Rails.root.to_s)}/(plugins|themes|spec)/([^/]+)/},diff --git a/spec/support/mock_git_importer.rb b/spec/support/mock_git_importer.rbindex 2f7c9bb487f..da6f3280d4c 100644--- a/spec/support/mock_git_importer.rb+++ b/spec/support/mock_git_importer.rb@@ -27,7 +27,7 @@ class MockGitImporter < ThemeStore::GitImporterenddef reset!- repos = nil+ @repos = nilendprivatediff --git a/spec/system/page_objects/components/pikaday_calendar.rb b/spec/system/page_objects/components/pikaday_calendar.rbindex f6b0afd076f..c8ae86f359e 100644--- a/spec/system/page_objects/components/pikaday_calendar.rb+++ b/spec/system/page_objects/components/pikaday_calendar.rb@@ -75,9 +75,6 @@ module PageObjectsenddef select_year(year)- # visible: false is here because pikaday sets the controls- # to opacity: 0 for some reason.- select_element = visible_pikaday.find(".pika-select-year", visible: false)page.driver.with_playwright_page do |playwright_page|playwright_page.eval_on_selector(".pika-select-year",