From 1297ad759e747bc5ccfded81d4c38be9ba412a32 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 5 Jun 2025 08:09:05 -0400 Subject: [PATCH] Update rubocop to version 1.76.0 (#34926) --- .rubocop/naming.yml | 3 +++ .rubocop_todo.yml | 2 +- Gemfile.lock | 6 +++--- app/controllers/auth/registrations_controller.rb | 2 +- app/models/concerns/attachmentable.rb | 2 +- app/models/user_settings/glue.rb | 2 +- config/initializers/1_hosts.rb | 2 +- config/initializers/content_security_policy.rb | 2 +- lib/mastodon/migration_warning.rb | 2 +- lib/mastodon/version.rb | 2 +- 10 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.rubocop/naming.yml b/.rubocop/naming.yml index da6ad4ac57..37d3a17efd 100644 --- a/.rubocop/naming.yml +++ b/.rubocop/naming.yml @@ -1,3 +1,6 @@ --- Naming/BlockForwarding: EnforcedStyle: explicit + +Naming/PredicateMethod: + Enabled: false diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 23f407ada0..a4cf131691 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config --auto-gen-only-exclude --no-offense-counts --no-auto-gen-timestamp` -# using RuboCop version 1.75.8. +# using RuboCop version 1.76.0. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new diff --git a/Gemfile.lock b/Gemfile.lock index 6b941f9751..14c3bd4247 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -751,7 +751,7 @@ GEM rspec-mocks (~> 3.0) sidekiq (>= 5, < 9) rspec-support (3.13.3) - rubocop (1.75.8) + rubocop (1.76.0) json (~> 2.3) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.1.0) @@ -759,10 +759,10 @@ GEM parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 2.9.3, < 3.0) - rubocop-ast (>= 1.44.0, < 2.0) + rubocop-ast (>= 1.45.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) - rubocop-ast (1.44.1) + rubocop-ast (1.45.0) parser (>= 3.3.7.2) prism (~> 1.4) rubocop-capybara (2.22.1) diff --git a/app/controllers/auth/registrations_controller.rb b/app/controllers/auth/registrations_controller.rb index 973724cf7c..3b42dc48ba 100644 --- a/app/controllers/auth/registrations_controller.rb +++ b/app/controllers/auth/registrations_controller.rb @@ -138,7 +138,7 @@ class Auth::RegistrationsController < Devise::RegistrationsController set_locale { render :rules } end - def is_flashing_format? # rubocop:disable Naming/PredicateName + def is_flashing_format? # rubocop:disable Naming/PredicatePrefix if params[:action] == 'create' false # Disable flash messages for sign-up else diff --git a/app/models/concerns/attachmentable.rb b/app/models/concerns/attachmentable.rb index a83e178fc4..783054b850 100644 --- a/app/models/concerns/attachmentable.rb +++ b/app/models/concerns/attachmentable.rb @@ -22,7 +22,7 @@ module Attachmentable ).freeze included do - def self.has_attached_file(name, options = {}) # rubocop:disable Naming/PredicateName + def self.has_attached_file(name, options = {}) # rubocop:disable Naming/PredicatePrefix super send(:"before_#{name}_validate", prepend: true) do diff --git a/app/models/user_settings/glue.rb b/app/models/user_settings/glue.rb index 02066a4110..c5ee1283e2 100644 --- a/app/models/user_settings/glue.rb +++ b/app/models/user_settings/glue.rb @@ -17,7 +17,7 @@ module UserSettings::Glue self.class.definition_for(key)&.type end - def has_attribute?(key) # rubocop:disable Naming/PredicateName + def has_attribute?(key) # rubocop:disable Naming/PredicatePrefix self.class.definition_for?(key) end end diff --git a/config/initializers/1_hosts.rb b/config/initializers/1_hosts.rb index 5c59e28bd1..638f6f6e55 100644 --- a/config/initializers/1_hosts.rb +++ b/config/initializers/1_hosts.rb @@ -21,7 +21,7 @@ Rails.application.configure do config.x.streaming_api_base_url = ENV.fetch('STREAMING_API_BASE_URL') do if Rails.env.production? - "ws#{https ? 's' : ''}://#{web_host}" + "ws#{'s' if https}://#{web_host}" else "ws://#{host.split(':').first}:4000" end diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index 931dc1d9b9..33894db93f 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -32,7 +32,7 @@ Rails.application.config.content_security_policy do |p| if Rails.env.development? vite_public_host = ENV.fetch('VITE_DEV_SERVER_PUBLIC', "localhost:#{ViteRuby.config.port}") - front_end_build_urls = %w(ws http).map { |protocol| "#{protocol}#{ViteRuby.config.https ? 's' : ''}://#{vite_public_host}" } + front_end_build_urls = %w(ws http).map { |protocol| "#{protocol}#{'s' if ViteRuby.config.https}://#{vite_public_host}" } p.connect_src :self, :data, :blob, *media_hosts, Rails.configuration.x.streaming_api_base_url, *front_end_build_urls p.script_src :self, :unsafe_inline, :unsafe_eval, assets_host diff --git a/lib/mastodon/migration_warning.rb b/lib/mastodon/migration_warning.rb index b90ceb2916..2a9a013891 100644 --- a/lib/mastodon/migration_warning.rb +++ b/lib/mastodon/migration_warning.rb @@ -23,7 +23,7 @@ module Mastodon def announce_countdown WARNING_SECONDS.downto(1) do |i| - say "Continuing in #{i} second#{i == 1 ? '' : 's'}...", true + say "Continuing in #{i} second#{'s' unless i == 1}...", true sleep 1 end end diff --git a/lib/mastodon/version.rb b/lib/mastodon/version.rb index d1abc322e6..396495784c 100644 --- a/lib/mastodon/version.rb +++ b/lib/mastodon/version.rb @@ -75,7 +75,7 @@ module Mastodon end def user_agent - @user_agent ||= "Mastodon/#{Version} (#{HTTP::Request::USER_AGENT}; +http#{Rails.configuration.x.use_https ? 's' : ''}://#{Rails.configuration.x.web_domain}/)" + @user_agent ||= "Mastodon/#{Version} (#{HTTP::Request::USER_AGENT}; +http#{'s' if Rails.configuration.x.use_https}://#{Rails.configuration.x.web_domain}/)" end def version_configuration