diff --git a/.github/workflows/analysis.yml b/.github/workflows/analysis.yml index d2512a4e..85a4b3f9 100644 --- a/.github/workflows/analysis.yml +++ b/.github/workflows/analysis.yml @@ -28,7 +28,6 @@ jobs: - uses: ruby/setup-ruby@v1 with: - ruby-version: "3.2" bundler-cache: true - name: Ruby Linting diff --git a/.rubocop.yml b/.rubocop.yml index 3734fd6b..e8c029f0 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -10,7 +10,6 @@ inherit_gem: rubocop-shopify: rubocop.yml AllCops: - TargetRubyVersion: 2.7 NewCops: enable Exclude: - test/allow_list_bench.rb diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 00000000..be94e6f5 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +3.2.2 diff --git a/Gemfile.lock b/Gemfile.lock index e7273746..ba0406ab 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -42,22 +42,25 @@ GEM redis-client (= 0.19.0) i18n (1.12.0) concurrent-ruby (~> 1.0) - json (2.6.3) + json (2.7.2) + language_server-protocol (3.17.0.3) memory_profiler (1.0.1) method_source (1.0.0) minitest (5.17.0) mocha (2.0.2) ruby2_keywords (>= 0.0.5) - mysql2 (0.5.4) - parallel (1.22.1) - parser (3.2.0.0) + mysql2 (0.5.6) + parallel (1.24.0) + parser (3.3.0.5) ast (~> 2.4.1) + racc pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) pry-byebug (3.10.1) byebug (~> 11.0) pry (>= 0.13, < 0.15) + racc (1.7.3) rainbow (3.1.1) rake (13.0.6) rake-compiler (1.2.1) @@ -66,33 +69,34 @@ GEM redis-client (>= 0.17.0) redis-client (0.19.0) connection_pool - regexp_parser (2.6.1) - rexml (3.2.5) - rubocop (1.43.0) + regexp_parser (2.9.0) + rexml (3.2.6) + rubocop (1.62.1) json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.2.0.0) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.24.1, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.24.1) - parser (>= 3.1.1.0) + rubocop-ast (1.31.2) + parser (>= 3.3.0.4) rubocop-minitest (0.26.1) rubocop (>= 0.90, < 2.0) rubocop-rake (0.6.0) rubocop (~> 1.0) rubocop-shopify (2.11.1) rubocop (~> 1.42) - ruby-progressbar (1.11.0) + ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) toxiproxy (2.0.2) trilogy (2.4.1) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.4.2) + unicode-display_width (2.5.0) webrick (1.7.0) PLATFORMS diff --git a/examples/net_http/12_bulkhead_quotes_in_forks.rb b/examples/net_http/12_bulkhead_quotes_in_forks.rb index 72ea080e..f7699cbe 100644 --- a/examples/net_http/12_bulkhead_quotes_in_forks.rb +++ b/examples/net_http/12_bulkhead_quotes_in_forks.rb @@ -17,7 +17,7 @@ SEMIAN_PARAMETERS = { bulkhead: true, quota: 1, # Tickets calculated base on number of workers - timeout: 1, # Timeout in seconds (1 sec) to wait to get a free ticket. + timeout: 1, # Timeout in seconds (1 sec) to wait to get a free ticket. circuit_breaker: false, } diff --git a/lib/semian/mysql2.rb b/lib/semian/mysql2.rb index e26ebd85..bfea2758 100644 --- a/lib/semian/mysql2.rb +++ b/lib/semian/mysql2.rb @@ -136,7 +136,8 @@ def acquire_semian_resource(**) def raw_semian_options return query_options[:semian] if query_options.key?(:semian) - return query_options["semian"] if query_options.key?("semian") + + query_options["semian"] if query_options.key?("semian") end end end diff --git a/lib/semian/redis.rb b/lib/semian/redis.rb index 929d5d3e..c7d48de0 100644 --- a/lib/semian/redis.rb +++ b/lib/semian/redis.rb @@ -151,7 +151,8 @@ def resource_exceptions def raw_semian_options return options[:semian] if options.key?(:semian) - return options["semian"] if options.key?("semian") + + options["semian"] if options.key?("semian") end def raise_if_out_of_memory(reply) diff --git a/semian.gemspec b/semian.gemspec index ca6a6603..95c8f214 100644 --- a/semian.gemspec +++ b/semian.gemspec @@ -27,6 +27,8 @@ Gem::Specification.new do |s| "source_code_uri" => "https://github.com/Shopify/semian", } + s.required_ruby_version = ">= 2.7.0" + s.files = Dir["{lib,ext}/**/**/*.{rb,h,c}"] s.files += ["LICENSE.md", "README.md"] s.extensions = ["ext/semian/extconf.rb"] diff --git a/test/adapters/grpc_test.rb b/test/adapters/grpc_test.rb index 253cb1b9..e1974ec6 100644 --- a/test/adapters/grpc_test.rb +++ b/test/adapters/grpc_test.rb @@ -18,7 +18,7 @@ class TestGRPC < Minitest::Test } DEFAULT_SEMIAN_CONFIGURATION = proc do |host| - if host == SemianConfig["toxiproxy_upstream_host"] && \ + if host == SemianConfig["toxiproxy_upstream_host"] && port == SemianConfig["toxiproxy_upstream_port"] # disable if toxiproxy next nil end diff --git a/test/adapters/net_http_test.rb b/test/adapters/net_http_test.rb index cc29ae9e..9e87826c 100644 --- a/test/adapters/net_http_test.rb +++ b/test/adapters/net_http_test.rb @@ -11,7 +11,7 @@ class TestNetHTTP < Minitest::Test error_timeout: 10, }.freeze DEFAULT_SEMIAN_CONFIGURATION = proc do |host, port| - if host == SemianConfig["toxiproxy_upstream_host"] && \ + if host == SemianConfig["toxiproxy_upstream_host"] && port == SemianConfig["toxiproxy_upstream_port"] # disable if toxiproxy next nil end @@ -311,7 +311,7 @@ def test_use_custom_configuration_to_combine_endpoints_into_one_resource sample_env = "development" semian_configuration_proc = proc do |host, port| - if host == SemianConfig["toxiproxy_upstream_host"] && \ + if host == SemianConfig["toxiproxy_upstream_host"] && port == SemianConfig["toxiproxy_upstream_port"] # disable if toxiproxy next nil end diff --git a/test/adapters/redis_client_test.rb b/test/adapters/redis_client_test.rb index f0ebf941..27b03758 100644 --- a/test/adapters/redis_client_test.rb +++ b/test/adapters/redis_client_test.rb @@ -405,14 +405,15 @@ def with_readonly_mode(client) def new_config(**options) options[:host] = SemianConfig["toxiproxy_upstream_host"] if options[:host].nil? semian_options = SEMIAN_OPTIONS.merge(options.delete(:semian) || {}) - RedisClient.config(**{ + RedisClient.config( port: SemianConfig["redis_toxiproxy_port"], reconnect_attempts: 0, db: 1, timeout: REDIS_TIMEOUT, semian: semian_options, driver: redis_driver, - }.merge(options)) + **options, + ) end def connect_to_redis!(semian_options = {})