Skip to content

Commit

Permalink
Maintenance: Update to Ruby 3.2.2.
Browse files Browse the repository at this point in the history
  • Loading branch information
mantas committed Jan 3, 2024
1 parent 8d6098c commit 9d50a0b
Show file tree
Hide file tree
Showing 22 changed files with 65 additions and 73 deletions.
2 changes: 1 addition & 1 deletion .gitlab/ci/__includes__/job_defaults.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
default:
image: $CI_REGISTRY/docker/zammad-ci:3.1.3
image: $CI_REGISTRY/docker/zammad-ci:3.2.2

tags:
- docker
Expand Down
2 changes: 1 addition & 1 deletion .gitlab/ci/test/migration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
- !reference [.scripts, zammad_db_init]
# Then, switch to the current commit, migrate to it and run a few selected tests.
- git checkout $CI_COMMIT_SHA
- rvm use 3.1.3
- rvm use 3.2.2
- !reference [.scripts, bundle_install]
# Force redis usage, even if it was disabled by the initial configure_environment script of stable.
- export REDIS_URL=redis://redis
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.3
3.2.2
10 changes: 2 additions & 8 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,9 @@
source 'https://rubygems.org'

# core - base
ruby '3.1.3'
ruby '3.2.2'
gem 'rails', '~> 7.0.8'

# TEMPORARY Security updates from Ruby 3.1.4. Can be removed when updating from Ruby 3.1.3 to a higher version.
# See also: https://www.ruby-lang.org/en/news/2023/03/30/ruby-3-1-4-released/
gem 'time', '>= 0.2.2'
gem 'uri', '>= 0.12.1'
# END TEMPORARY

# core - rails additions
gem 'activerecord-import'
gem 'activerecord-session_store'
Expand All @@ -26,7 +20,7 @@ gem 'puma', group: :puma
# core - supported ORMs
gem 'activerecord-nulldb-adapter', group: :nulldb
gem 'mysql2', group: :mysql
gem 'pg', '~> 1.2.0', group: :postgres
gem 'pg', '~> 1.5', '>= 1.5.4', group: :postgres

# core - asynchrous task execution
gem 'daemons'
Expand Down
8 changes: 3 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ GEM
parser (3.2.2.4)
ast (~> 2.4.1)
racc
pg (1.2.3)
pg (1.5.4)
power_assert (2.0.3)
promise.rb (0.7.4)
pry (0.14.2)
Expand Down Expand Up @@ -786,7 +786,7 @@ DEPENDENCIES
openssl
overcommit
parallel
pg (~> 1.2.0)
pg (~> 1.5, >= 1.5.4)
pry-byebug
pry-doc
pry-rails
Expand Down Expand Up @@ -827,11 +827,9 @@ DEPENDENCIES
terser
test-unit
thor
time (>= 0.2.2)
twilio-ruby
twitter
tzinfo-data
uri (>= 0.12.1)
vcr
viewpoint
vite_rails
Expand All @@ -841,7 +839,7 @@ DEPENDENCIES
zendesk_api

RUBY VERSION
ruby 3.1.3p185
ruby 3.2.2p53

BUNDLED WITH
2.4.1
6 changes: 3 additions & 3 deletions app/graphql/gql/concerns/handles_authorization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ def self.authorize(...)
#

# This method is used by GraphQL to perform authorization on the various objects.
def self.authorized?(*args)
def self.authorized?(*)
# ctx = args[-1] # This may be called with 2 or 3 params, context is last.

before_authorize(*args)
before_authorize(*)

# Authorize
authorize(*args)
authorize(*)
rescue Pundit::NotAuthorizedError # Map to 'Forbidden'
raise Exceptions::Forbidden, "Access forbidden by #{name}"
end
Expand Down
12 changes: 6 additions & 6 deletions app/graphql/gql/types/concerns/has_model_relations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ module Gql::Types::Concerns::HasModelRelations
# because the ConnectionTypes generate their own, non-preloadable queries.
# See also https://github.com/Shopify/graphql-batch/issues/114.

def belongs_to(association, *args, **kwargs, &)
def belongs_to(association, *, **kwargs, &)
kwargs[:resolver_class] = Gql::Resolvers::BelongsToResolver

field(association, *args, **kwargs, is_dependent_field: true, &)
field(association, *, **kwargs, is_dependent_field: true, &)
end

def has_one(association, *args, **kwargs, &)
def has_one(association, *, **kwargs, &)
kwargs[:resolver_class] = Gql::Resolvers::HasOneResolver

field(association, *args, **kwargs, is_dependent_field: true, &)
field(association, *, **kwargs, is_dependent_field: true, &)
end

def lookup_field(name, *args, **kwargs, &)
def lookup_field(name, *, **kwargs, &)
kwargs[:resolver_class] = Gql::Resolvers::LookupResolver

field(name, *args, **kwargs, &)
field(name, *, **kwargs, &)
end
end
end
4 changes: 2 additions & 2 deletions app/helpers/translation_helper.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/

module TranslationHelper
def zammad_translate(string, *args)
Translation.translate(system_locale_via_uri&.locale, string, *args)
def zammad_translate(string, *)
Translation.translate(system_locale_via_uri&.locale, string, *)
end

alias zt zammad_translate
Expand Down
4 changes: 2 additions & 2 deletions app/models/concerns/can_perform_changes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ def notification_action(object_name, object_key, action_value, _prepared_actions
{ name: :"notification_#{object_key}", value: action_value }
end

def additional_object_action(*args)
def additional_object_action(*)
return if !respond_to?(:additional_object_actions)

additional_object_action(*args)
additional_object_action(*)
end

def object_action(object_name, object_key, action_value, _prepared_actions)
Expand Down
4 changes: 2 additions & 2 deletions app/models/store/provider/s3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def log_and_raise(error)
raise Store::Provider::S3::Error, __('Simple Storage Service malfunction. Please contact your Zammad administrator.')
end

def request(method, **kwargs)
client.send(method, bucket: bucket, **kwargs)
def request(method, **)
client.send(method, bucket: bucket, **)
rescue => e
log_and_raise(e)
end
Expand Down
6 changes: 3 additions & 3 deletions config/initializers/activemodel_error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ class Errors
alias orig_add add

# This will add custom string errors to the I18n translation store.
def add(attribute, type = :invalid, **options)
return orig_add(attribute, type, **options) if !type.is_a?(String)
def add(attribute, type = :invalid, **)
return orig_add(attribute, type, **) if !type.is_a?(String)

# I18n uses namespacing to access the messages, so generate a safe symbol without the namespace separator '.'.
type_sym = type.gsub(%r{\W}, '').to_sym
::I18n.backend.translations[:en][:errors][:messages][type_sym] = type
orig_add(attribute, type_sym, **options)
orig_add(attribute, type_sym, **)
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions lib/core_ext/activesupport/lib/active_support/callbacks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ module ActiveSupport::Callbacks::ClassMethods
# #=> 'example return value'
#
# @return [optional] Returns the return value of the given block
def without_callback(*args)
def without_callback(*)
begin
skip_callback(*args)
skip_callback(*)
result = yield
ensure
set_callback(*args)
set_callback(*)
end
result
end
Expand Down
4 changes: 2 additions & 2 deletions lib/core_ext/object.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/

class Object
def to_utf8(**options)
to_s.utf8_encode(**options)
def to_utf8(**)
to_s.utf8_encode(**)
end
end
28 changes: 14 additions & 14 deletions lib/import/base_factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,39 @@ module Import
module BaseFactory
extend self

def import_action(records, *args)
pre_import_hook(records, *args)
import_loop(records, *args) do |record|
next if skip?(record, *args)
def import_action(records, *)
pre_import_hook(records, *)
import_loop(records, *) do |record|
next if skip?(record, *)

backend_instance = create_instance(record, *args)
post_import_hook(record, backend_instance, *args)
backend_instance = create_instance(record, *)
post_import_hook(record, backend_instance, *)
end
end

def import(_records, *_args)
def import(_records, *)
raise 'Missing import method implementation for this factory'
end

def pre_import_hook(_records, *args); end
def pre_import_hook(_records, *); end

def post_import_hook(_record, _backend_instance, *args); end
def post_import_hook(_record, _backend_instance, *); end

def backend_class(_record, *_args)
def backend_class(_record, *)
"Import::#{module_name}".constantize
end

def skip?(_record, *_args)
def skip?(_record, *)
false
end

private

def create_instance(record, *args)
backend_class(record, *args).new(record, *args)
def create_instance(record, *)
backend_class(record, *).new(record, *)
end

def import_loop(records, *_args, &)
def import_loop(records, *, &)
records.each(&)
end

Expand Down
4 changes: 2 additions & 2 deletions lib/import/transaction_factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ module TransactionFactory
# rubocop:disable Style/ModuleFunction
extend self

def import(records, *args)
def import(records, *)
ActiveRecord::Base.transaction do
import_action(records, *args)
import_action(records, *)
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions lib/ldap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ def search(filter, base: nil, scope: nil, attributes: nil, &block)
# #=> true
#
# @return [Boolean] Returns true if entries are present false if not.
def entries?(*args)
def entries?(*)
found = false
search(*args) do |_entry|
search(*) do |_entry|
found = true
break
end
Expand All @@ -100,9 +100,9 @@ def entries?(*args)
# #=> 10
#
# @return [Number] The count of matching entries.
def count(*args)
def count(*)
counter = 0
search(*args) do |_entry|
search(*) do |_entry|
counter += 1
end
counter
Expand Down
4 changes: 2 additions & 2 deletions lib/sequencer/unit/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@ def instance_variable_cached(key, &)

# This method is an convenience wrapper to create an instance
# and then directly processing it.
def self.process(*args)
new(*args).process
def self.process(*)
new(*).process
end

def initialize(state)
Expand Down
4 changes: 2 additions & 2 deletions lib/validations/object_manager/attribute_validator/backend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def initialize(record:, attribute:)
@previous_value = record.attribute_in_database(attribute.name)
end

def invalid_because_attribute(message, **options)
record.errors.add attribute.name.to_sym, message, **options
def invalid_because_attribute(message, **)
record.errors.add attribute.name.to_sym, message, **
end
end
4 changes: 2 additions & 2 deletions spec/models/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,9 @@ def change_setting_ticket_agent_default_notifications
let(:ids_executed) { [] }

before do
allow_any_instance_of(described_class).to receive(:out_of_office_agent).and_wrap_original do |method, *args|
allow_any_instance_of(described_class).to receive(:out_of_office_agent).and_wrap_original do |method, **kwargs|
ids_executed << method.receiver.id
method.call(*args)
method.call(**kwargs)
end

allow(Rails.logger).to receive(:warn)
Expand Down
8 changes: 4 additions & 4 deletions spec/support/capybara/browser_test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ def delete_cookie(name)
#
# click(:href, '#settings/branding')
#
def click(*args)
find(*args).click
def click(...)
find(...).click
end

# Finds svg icon in Mobile View
Expand All @@ -91,8 +91,8 @@ def find_icon(name)
# @example
# wait(5, interval: 0.5).until { ... }
#
def wait(seconds = Capybara.default_max_wait_time, **kargs)
wait_args = Hash(kargs).merge(timeout: seconds)
def wait(seconds = Capybara.default_max_wait_time, **kwargs)
wait_args = Hash(kwargs).merge(timeout: seconds)
wait_handle = Selenium::WebDriver::Wait.new(wait_args)
Waiter.new(wait_handle)
end
Expand Down
4 changes: 2 additions & 2 deletions spec/support/capybara/common_actions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ def have_current_route(route, app: self.class.metadata[:app], **options) # ruboc
# expect_current_route('login')
# => checks for SPA route '/#login'
#
def expect_current_route(route, app: self.class.metadata[:app], **options)
expect(page).to have_current_route(route, app: app, **options)
def expect_current_route(route, app: self.class.metadata[:app], **)
expect(page).to have_current_route(route, app: app, **)
end

# Create and migrate an object manager attribute and verify that it exists. Returns the newly attribute.
Expand Down
4 changes: 2 additions & 2 deletions spec/support/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ def authenticated_as(user, via: :api_client, **options)
# # => {firstname: 'Nicole', email: '[email protected]', ...}
#
# @return [Hash{Symbol => <String, Array, Hash>}] request cleaned attributes
def attributes_params_for(*args)
filter_unused_params(attributes_for(*args))
def attributes_params_for(*)
filter_unused_params(attributes_for(*))
end

# Provides a Hash of attributes for the given Model instance which can
Expand Down

0 comments on commit 9d50a0b

Please sign in to comment.