Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby 3 preparation #4092

Merged
merged 5 commits into from
Feb 11, 2024
Merged

Ruby 3 preparation #4092

merged 5 commits into from
Feb 11, 2024

Conversation

orien
Copy link
Contributor

@orien orien commented Feb 10, 2024

Context

There's a change in Ruby 3.0 that separates positional and keyword arguments.

Change

In preparation for the Ruby 3.0 upgrade, update classes to correctly pass keyword arguments in method calls.

@orien orien marked this pull request as ready for review February 11, 2024 00:34
@orien orien requested review from a team and grosser as code owners February 11, 2024 00:34
Comment on lines 75 to +81
VaultClientWrapper.new(
DEFAULT_CLIENT_OPTIONS.merge(
address: address,
ssl_cert_store: cert_store,
ssl_verify: tls_verify,
token: token,
versioned_kv: versioned_kv?
)
**DEFAULT_CLIENT_OPTIONS,
address: address,
ssl_cert_store: cert_store,
ssl_verify: tls_verify,
token: token,
versioned_kv: versioned_kv?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The VaultClientWrapper class accepts keyword arguments in its initializer. Update this call to match.

def initialize(versioned_kv:, **client_args)

@@ -24,5 +24,5 @@ class SamsonPlugin < Rails::Engine

Samson::Hooks.callback :error do |exception, **options|
sentry_options = options.slice(:contexts, :extra, :tags, :user, :level, :fingerprint)
Sentry.capture_exception(exception, sentry_options)
Sentry.capture_exception(exception, **sentry_options)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Sentry.capture_exception method accepts keyword arguments. Update this method call to match.

https://github.com/getsentry/sentry-ruby/blob/1d8054837bedda96342c5f7b4bcfe9d87614c4da/sentry-ruby/lib/sentry-ruby.rb#L398

@@ -32,7 +32,7 @@ def new
case params[:type]
when "users"
options = user_filter
send_data UserCsvPresenter.to_csv(options), type: :csv, filename: "Users_#{options[:datetime]}.csv"
send_data UserCsvPresenter.to_csv(**options), type: :csv, filename: "Users_#{options[:datetime]}.csv"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The UserCsvPresenter.to_csv method accepts keyword arguments. Update this method call to match.

def self.to_csv(
inherited: false, deleted: false, project_id: nil, user_id: nil, datetime: (Time.now.strftime "%Y%m%d_%H%M")
)

ActionCable.server.broadcast channel_name, count: count
ActionCable.server.broadcast(channel_name, {count: count})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The message sent via the the ActionCable::Server::Broadcasting#broadcast method is a Hash.

Explicitly send a hash in this method call.

Copy link
Contributor

@grosser grosser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@grosser grosser merged commit 5b372e5 into zendesk:master Feb 11, 2024
9 checks passed
@orien orien deleted the ruby-3-preparation branch February 11, 2024 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants