From 8837fd8c54e4f9bb016a94ef2624052176de4bdf Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 23 Jun 2025 03:40:11 -0400 Subject: [PATCH] Update rubocop to version 1.77.0 (#35128) --- .rubocop_todo.yml | 4 ++-- Gemfile.lock | 2 +- app/controllers/api/v1/filters_controller.rb | 2 +- app/policies/backup_policy.rb | 2 +- lib/tasks/tests.rake | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 5f0eaac8e..4ec92f341 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.76.2. +# using RuboCop version 1.77.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 @@ -28,7 +28,7 @@ Metrics/PerceivedComplexity: Max: 27 # This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowedVars. +# Configuration parameters: AllowedVars, DefaultToNil. Style/FetchEnvVar: Exclude: - 'config/initializers/paperclip.rb' diff --git a/Gemfile.lock b/Gemfile.lock index 7583b197e..84dfce44a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -761,7 +761,7 @@ GEM rspec-mocks (~> 3.0) sidekiq (>= 5, < 9) rspec-support (3.13.4) - rubocop (1.76.2) + rubocop (1.77.0) json (~> 2.3) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.1.0) diff --git a/app/controllers/api/v1/filters_controller.rb b/app/controllers/api/v1/filters_controller.rb index 5e9ba5153..a7031f887 100644 --- a/app/controllers/api/v1/filters_controller.rb +++ b/app/controllers/api/v1/filters_controller.rb @@ -32,7 +32,7 @@ class Api::V1::FiltersController < Api::BaseController ApplicationRecord.transaction do @filter.update!(keyword_params) @filter.custom_filter.assign_attributes(filter_params) - raise Mastodon::ValidationError, I18n.t('filters.errors.deprecated_api_multiple_keywords') if @filter.custom_filter.changed? && @filter.custom_filter.keywords.count > 1 + raise Mastodon::ValidationError, I18n.t('filters.errors.deprecated_api_multiple_keywords') if @filter.custom_filter.changed? && @filter.custom_filter.keywords.many? @filter.custom_filter.save! end diff --git a/app/policies/backup_policy.rb b/app/policies/backup_policy.rb index 7a4c5b434..bba69a28e 100644 --- a/app/policies/backup_policy.rb +++ b/app/policies/backup_policy.rb @@ -4,6 +4,6 @@ class BackupPolicy < ApplicationPolicy MIN_AGE = 6.days def create? - user_signed_in? && current_user.backups.where(created_at: MIN_AGE.ago..).count.zero? + user_signed_in? && current_user.backups.where(created_at: MIN_AGE.ago..).none? end end diff --git a/lib/tasks/tests.rake b/lib/tasks/tests.rake index 74269439d..9385e390d 100644 --- a/lib/tasks/tests.rake +++ b/lib/tasks/tests.rake @@ -112,17 +112,17 @@ namespace :tests do exit(1) end - unless Identity.where(provider: 'foo', uid: 0).count == 1 + unless Identity.where(provider: 'foo', uid: 0).one? puts 'Identities not deduplicated as expected' exit(1) end - unless WebauthnCredential.where(user_id: 1, nickname: 'foo').count == 1 + unless WebauthnCredential.where(user_id: 1, nickname: 'foo').one? puts 'Webauthn credentials not deduplicated as expected' exit(1) end - unless AccountAlias.where(account_id: 1, uri: 'https://example.com/users/foobar').count == 1 + unless AccountAlias.where(account_id: 1, uri: 'https://example.com/users/foobar').one? puts 'Account aliases not deduplicated as expected' exit(1) end