From 09ab2829da1877a78b238cdb025d5bf4fe279915 Mon Sep 17 00:00:00 2001 From: Nicholas La Roux Date: Mon, 15 Dec 2025 07:57:16 -0500 Subject: [PATCH] Upgrade `rubocop-rails` from `2.33.4` to `2.34.2` and address related offenses (#37243) --- Gemfile.lock | 2 +- app/controllers/activitypub/inboxes_controller.rb | 2 +- app/lib/request.rb | 2 +- config/boot.rb | 2 +- config/initializers/active_record_encryption.rb | 4 ++-- config/initializers/deprecations.rb | 2 +- config/initializers/vips.rb | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index b2347c1863..c40b45088d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -773,7 +773,7 @@ GEM lint_roller (~> 1.1) rubocop (>= 1.75.0, < 2.0) rubocop-ast (>= 1.47.1, < 2.0) - rubocop-rails (2.33.4) + rubocop-rails (2.34.2) activesupport (>= 4.2.0) lint_roller (~> 1.1) rack (>= 1.1) diff --git a/app/controllers/activitypub/inboxes_controller.rb b/app/controllers/activitypub/inboxes_controller.rb index 49cfc8ad1c..1f7abb97fa 100644 --- a/app/controllers/activitypub/inboxes_controller.rb +++ b/app/controllers/activitypub/inboxes_controller.rb @@ -39,7 +39,7 @@ class ActivityPub::InboxesController < ActivityPub::BaseController return @body if defined?(@body) @body = request.body.read - @body.force_encoding('UTF-8') if @body.present? + @body.presence&.force_encoding('UTF-8') request.body.rewind if request.body.respond_to?(:rewind) diff --git a/app/lib/request.rb b/app/lib/request.rb index dd65b481d8..06c917c426 100644 --- a/app/lib/request.rb +++ b/app/lib/request.rb @@ -275,7 +275,7 @@ class Request end if ::HTTP::Response.methods.include?(:body_with_limit) && !Rails.env.production? - abort 'HTTP::Response#body_with_limit is already defined, the monkey patch will not be applied' + raise 'HTTP::Response#body_with_limit is already defined, the monkey patch will not be applied' else class ::HTTP::Response include Request::ClientLimit diff --git a/config/boot.rb b/config/boot.rb index 70ffe22c04..29e8e9e349 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true unless ENV.key?('RAILS_ENV') - abort <<~ERROR + abort <<~ERROR # rubocop:disable Rails/Exit The RAILS_ENV environment variable is not set. Please set it correctly depending on context: diff --git a/config/initializers/active_record_encryption.rb b/config/initializers/active_record_encryption.rb index 9ae28e401b..3f9125674c 100644 --- a/config/initializers/active_record_encryption.rb +++ b/config/initializers/active_record_encryption.rb @@ -13,7 +13,7 @@ value = ENV.fetch(key, '') if value.blank? - abort <<~MESSAGE + abort <<~MESSAGE # rubocop:disable Rails/Exit Mastodon now requires that these variables are set: @@ -28,7 +28,7 @@ next unless Rails.env.production? && value.end_with?('DO_NOT_USE_IN_PRODUCTION') - abort <<~MESSAGE + abort <<~MESSAGE # rubocop:disable Rails/Exit It looks like you are trying to run Mastodon in production with a #{key} value from the test environment. diff --git a/config/initializers/deprecations.rb b/config/initializers/deprecations.rb index 15c701c9c1..520707e59f 100644 --- a/config/initializers/deprecations.rb +++ b/config/initializers/deprecations.rb @@ -14,7 +14,7 @@ if ENV['REDIS_NAMESPACE'] In addition, as REDIS_NAMESPACE is being used as a prefix for Elasticsearch, please do not forget to set ES_PREFIX to "#{ENV.fetch('REDIS_NAMESPACE')}". MESSAGE - abort message + abort message # rubocop:disable Rails/Exit end if ENV['MASTODON_USE_LIBVIPS'] == 'false' diff --git a/config/initializers/vips.rb b/config/initializers/vips.rb index a539d7035c..09210d60eb 100644 --- a/config/initializers/vips.rb +++ b/config/initializers/vips.rb @@ -6,7 +6,7 @@ if Rails.configuration.x.use_vips require 'vips' unless Vips.at_least_libvips?(8, 13) - abort <<~ERROR.squish + abort <<~ERROR.squish # rubocop:disable Rails/Exit Incompatible libvips version (#{Vips.version_string}), please install libvips >= 8.13 ERROR end