From 420b2fe5640eaedd898e1bdc73d2a9587863591d Mon Sep 17 00:00:00 2001 From: Santiago Traversa Date: Sat, 27 Dec 2025 14:14:24 -0300 Subject: [PATCH 1/5] Update .rubocop_todo.yml --- .rubocop.yml | 2 +- .rubocop_todo.yml | 43 ++++++++++++++++++++++++++++++++++++++----- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 4bb7d944..5468f1c4 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -9,7 +9,7 @@ plugins: - rubocop-rspec AllCops: - TargetRubyVersion: 3.0 + TargetRubyVersion: 3.2 Exclude: - '*.gemspec' - 'Rakefile' diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index b785f9ac..3d6d4979 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,12 +1,20 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2023-01-26 12:48:02 UTC using RuboCop version 1.44.1. +# on 2025-12-27 17:14:14 UTC using RuboCop version 1.82.1. # 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 # versions of RuboCop, may require this file to be generated again. -# Offense count: 74 +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, BlockForwardingName. +# SupportedStyles: anonymous, explicit +Naming/BlockForwarding: + Exclude: + - 'lib/dnsimple/extra.rb' + +# Offense count: 90 # Configuration parameters: CountAsOne. RSpec/ExampleLength: Max: 17 @@ -22,11 +30,11 @@ RSpec/LeakyConstantDeclaration: RSpec/MessageSpies: EnforcedStyle: receive -# Offense count: 115 +# Offense count: 134 RSpec/MultipleExpectations: Max: 15 -# Offense count: 372 +# Offense count: 422 # Configuration parameters: EnforcedStyle, IgnoreSharedExamples. # SupportedStyles: always, named_only RSpec/NamedSubject: @@ -48,7 +56,32 @@ RSpec/SubjectStub: - 'spec/dnsimple/client/zones_spec.rb' - 'spec/dnsimple/client_spec.rb' -# Offense count: 69 +# Offense count: 4 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowOnlyRestArgument, UseAnonymousForwarding, RedundantRestArgumentNames, RedundantKeywordRestArgumentNames, RedundantBlockArgumentNames. +# RedundantRestArgumentNames: args, arguments +# RedundantKeywordRestArgumentNames: kwargs, options, opts +# RedundantBlockArgumentNames: blk, block, proc +Style/ArgumentsForwarding: + Exclude: + - 'lib/dnsimple/client/identity.rb' + - 'lib/dnsimple/extra.rb' + +# Offense count: 83 # Configuration parameters: AllowedConstants. Style/Documentation: Enabled: false + +# Offense count: 23 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. +# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys +# SupportedShorthandSyntax: always, never, either, consistent, either_consistent +Style/HashSyntax: + Exclude: + - 'Rakefile' + - 'lib/dnsimple/client.rb' + - 'lib/dnsimple/client/oauth.rb' + - 'lib/dnsimple/client/zones_records.rb' + - 'lib/dnsimple/options.rb' + - 'spec/dnsimple/client/oauth_spec.rb' From 01865f48ac1f314276dcf39e8c180e9b63a445b6 Mon Sep 17 00:00:00 2001 From: Santiago Traversa Date: Sat, 27 Dec 2025 14:15:04 -0300 Subject: [PATCH 2/5] [Corrected] Style/HashSyntax: Omit the hash value --- .rubocop_todo.yml | 8 -------- lib/dnsimple/client.rb | 2 +- lib/dnsimple/client/oauth.rb | 2 +- lib/dnsimple/client/zones_records.rb | 2 +- lib/dnsimple/extra.rb | 4 ++-- lib/dnsimple/options.rb | 2 +- spec/dnsimple/client/oauth_spec.rb | 12 ++++++------ 7 files changed, 12 insertions(+), 20 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 3d6d4979..197b88f8 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -6,14 +6,6 @@ # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, BlockForwardingName. -# SupportedStyles: anonymous, explicit -Naming/BlockForwarding: - Exclude: - - 'lib/dnsimple/extra.rb' - # Offense count: 90 # Configuration parameters: CountAsOne. RSpec/ExampleLength: diff --git a/lib/dnsimple/client.rb b/lib/dnsimple/client.rb index b46712f5..4283ac65 100644 --- a/lib/dnsimple/client.rb +++ b/lib/dnsimple/client.rb @@ -229,7 +229,7 @@ def add_proxy_options!(options) def add_auth_options!(options) if password - options[:basic_auth] = { username: username, password: password } + options[:basic_auth] = { username:, password: } elsif access_token options[:headers][HEADER_AUTHORIZATION] = "Bearer #{access_token}" end diff --git a/lib/dnsimple/client/oauth.rb b/lib/dnsimple/client/oauth.rb index c2ec83da..3dec62ae 100644 --- a/lib/dnsimple/client/oauth.rb +++ b/lib/dnsimple/client/oauth.rb @@ -13,7 +13,7 @@ module Oauth # @option options [String] :redirect_uri The redirect URL sent for the authorization, used to validate the request. # @return [String] The url to redirect the user to authorize. def exchange_authorization_for_token(code, client_id, client_secret, options = {}) - attributes = { code: code, client_id: client_id, client_secret: client_secret, grant_type: "authorization_code" } + attributes = { code:, client_id:, client_secret:, grant_type: "authorization_code" } attributes[:state] = options.delete(:state) if options.key?(:state) attributes[:redirect_uri] = options.delete(:redirect_uri) if options.key?(:redirect_uri) response = client.post(Client.versioned("/oauth/access_token"), attributes, options) diff --git a/lib/dnsimple/client/zones_records.rb b/lib/dnsimple/client/zones_records.rb index cf1ba5ac..43c743ad 100644 --- a/lib/dnsimple/client/zones_records.rb +++ b/lib/dnsimple/client/zones_records.rb @@ -185,7 +185,7 @@ def batch_change_zone_records(account_id, zone_id, attributes, options = {}) deletes_data = response["data"]["deletes"] || [] deletes = deletes_data.map { |r| Struct::ZoneRecordId.new(r) } end - Dnsimple::Response.new(response, Struct::ZoneRecordsBatchChange.new({ creates: creates, updates: updates, deletes: deletes })) + Dnsimple::Response.new(response, Struct::ZoneRecordsBatchChange.new({ creates:, updates:, deletes: })) end end end diff --git a/lib/dnsimple/extra.rb b/lib/dnsimple/extra.rb index a2fa8cfe..7b4fd883 100644 --- a/lib/dnsimple/extra.rb +++ b/lib/dnsimple/extra.rb @@ -23,8 +23,8 @@ def self.join_uri(*parts) # h2 = { b: 250, c: { c1: 200 } } # Extra.deep_merge(h1, h2) { |key, this_val, other_val| this_val + other_val } # # => { a: 100, b: 450, c: { c1: 300 } } - def self.deep_merge(this, other, &block) - deep_merge!(this.dup, other, &block) + def self.deep_merge(this, other, &) + deep_merge!(this.dup, other, &) end # Same as +deep_merge+, but modifies +this+ instead of returning a new hash. diff --git a/lib/dnsimple/options.rb b/lib/dnsimple/options.rb index 501eae46..65112daf 100644 --- a/lib/dnsimple/options.rb +++ b/lib/dnsimple/options.rb @@ -48,7 +48,7 @@ def _prepare_filter def _prepare_groupings groupings = @options.delete(:groupings) - _merge({ groupings: groupings }) unless groupings.nil? + _merge({ groupings: }) unless groupings.nil? end def _merge(hash) diff --git a/spec/dnsimple/client/oauth_spec.rb b/spec/dnsimple/client/oauth_spec.rb index f6795d2e..0494c8c0 100644 --- a/spec/dnsimple/client/oauth_spec.rb +++ b/spec/dnsimple/client/oauth_spec.rb @@ -19,15 +19,15 @@ end it "builds the correct request" do - subject.exchange_authorization_for_token(code, client_id, client_secret, state: state) + subject.exchange_authorization_for_token(code, client_id, client_secret, state:) expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/oauth/access_token") - .with(body: { client_id: client_id, client_secret: client_secret, code: code, state: state, grant_type: "authorization_code" }) + .with(body: { client_id:, client_secret:, code:, state:, grant_type: "authorization_code" }) .with(headers: { "Accept" => "application/json" }) end it "returns oauth token" do - result = subject.exchange_authorization_for_token(code, client_id, client_secret, state: state) + result = subject.exchange_authorization_for_token(code, client_id, client_secret, state:) expect(result).to be_a(Dnsimple::Struct::OauthToken) expect(result.access_token).to eq("zKQ7OLqF5N1gylcJweA9WodA000BUNJD") @@ -39,10 +39,10 @@ let(:redirect_uri) { "super-redirect-uri" } it "builds the correct request" do - subject.exchange_authorization_for_token(code, client_id, client_secret, state: state, redirect_uri: redirect_uri) + subject.exchange_authorization_for_token(code, client_id, client_secret, state:, redirect_uri:) expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/oauth/access_token") - .with(body: { client_id: client_id, client_secret: client_secret, code: code, state: state, redirect_uri: redirect_uri, grant_type: "authorization_code" }) + .with(body: { client_id:, client_secret:, code:, state:, redirect_uri:, grant_type: "authorization_code" }) .with(headers: { "Accept" => "application/json" }) end end @@ -55,7 +55,7 @@ it "raises OAuthInvalidRequestError" do expect { - subject.exchange_authorization_for_token(code, client_id, client_secret, state: state) + subject.exchange_authorization_for_token(code, client_id, client_secret, state:) }.to raise_error(Dnsimple::OAuthInvalidRequestError) do |e| error = "invalid_request" error_description = "Invalid \"state\": value doesn't match the \"state\" in the authorization request" From c8096faca2f9c2d819784661566acdc6bba81472 Mon Sep 17 00:00:00 2001 From: Santiago Traversa Date: Sat, 27 Dec 2025 14:17:03 -0300 Subject: [PATCH 3/5] [Corrected] Style/ArgumentsForwarding: Use anonymous positional arguments forwarding (*). --- .rubocop_todo.yml | 25 ------------------------- lib/dnsimple/client/identity.rb | 4 ++-- 2 files changed, 2 insertions(+), 27 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 197b88f8..8495ec82 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -48,32 +48,7 @@ RSpec/SubjectStub: - 'spec/dnsimple/client/zones_spec.rb' - 'spec/dnsimple/client_spec.rb' -# Offense count: 4 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowOnlyRestArgument, UseAnonymousForwarding, RedundantRestArgumentNames, RedundantKeywordRestArgumentNames, RedundantBlockArgumentNames. -# RedundantRestArgumentNames: args, arguments -# RedundantKeywordRestArgumentNames: kwargs, options, opts -# RedundantBlockArgumentNames: blk, block, proc -Style/ArgumentsForwarding: - Exclude: - - 'lib/dnsimple/client/identity.rb' - - 'lib/dnsimple/extra.rb' - # Offense count: 83 # Configuration parameters: AllowedConstants. Style/Documentation: Enabled: false - -# Offense count: 23 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. -# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys -# SupportedShorthandSyntax: always, never, either, consistent, either_consistent -Style/HashSyntax: - Exclude: - - 'Rakefile' - - 'lib/dnsimple/client.rb' - - 'lib/dnsimple/client/oauth.rb' - - 'lib/dnsimple/client/zones_records.rb' - - 'lib/dnsimple/options.rb' - - 'spec/dnsimple/client/oauth_spec.rb' diff --git a/lib/dnsimple/client/identity.rb b/lib/dnsimple/client/identity.rb index d060042d..51775205 100644 --- a/lib/dnsimple/client/identity.rb +++ b/lib/dnsimple/client/identity.rb @@ -26,8 +26,8 @@ module StaticHelpers # @param [Array] args the args for the {Identity#whoami} call # @return [Hash] # @raise [Dnsimple::RequestError] - def whoami(client, *args) - client.identity.whoami(*args).data + def whoami(client, *) + client.identity.whoami(*).data end end end From 0758136a620dd98e34b444be09cd9def5dd78ec7 Mon Sep 17 00:00:00 2001 From: Santiago Traversa Date: Sat, 27 Dec 2025 14:43:25 -0300 Subject: [PATCH 4/5] Update dnsimple.gemspec --- dnsimple.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dnsimple.gemspec b/dnsimple.gemspec index 789f2cc2..6936e89c 100644 --- a/dnsimple.gemspec +++ b/dnsimple.gemspec @@ -11,7 +11,7 @@ Gem::Specification.new do |s| s.summary = 'The DNSimple API client for Ruby' s.description = 'The DNSimple API client for Ruby.' - s.required_ruby_version = ">= 2.7" + s.required_ruby_version = ['>= 3.2', '< 4'] s.require_paths = ['lib'] s.files = `git ls-files`.split("\n") From c1776eba2fc494ddea4030cc23abb68fa099384c Mon Sep 17 00:00:00 2001 From: Santiago Traversa Date: Sat, 27 Dec 2025 17:31:46 -0300 Subject: [PATCH 5/5] task: Adds Ruby 4.0 to CI test matrix --- .github/workflows/ci.yml | 1 + dnsimple.gemspec | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8feccddd..1d522926 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,6 +35,7 @@ jobs: - '3.2' - '3.3' - '3.4' + - '4.0' - 'ruby-head' - 'truffleruby-head' steps: diff --git a/dnsimple.gemspec b/dnsimple.gemspec index 6936e89c..dfd3752d 100644 --- a/dnsimple.gemspec +++ b/dnsimple.gemspec @@ -11,7 +11,7 @@ Gem::Specification.new do |s| s.summary = 'The DNSimple API client for Ruby' s.description = 'The DNSimple API client for Ruby.' - s.required_ruby_version = ['>= 3.2', '< 4'] + s.required_ruby_version = ['>= 3.2', '< 5'] s.require_paths = ['lib'] s.files = `git ls-files`.split("\n")