diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6a863d9..8f4f4c7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,7 +10,7 @@ jobs: - uses: ruby/setup-ruby@v1 with: - ruby-version: "3.0" + ruby-version: "3.1" bundler-cache: true - name: Run rubocop @@ -20,7 +20,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby: ["3.0", "3.1", "3.2", "3.3"] + ruby: [3.1", "3.2", "3.3"] steps: - uses: actions/checkout@v2 @@ -53,7 +53,7 @@ jobs: - uses: ruby/setup-ruby@v1 with: - ruby-version: "3.0" + ruby-version: "3.1" bundler-cache: true - name: Build gem diff --git a/.rubocop.yml b/.rubocop.yml index 7956fc0..44e9c66 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,5 +1,5 @@ AllCops: - TargetRubyVersion: 3.0 + TargetRubyVersion: 3.1 NewCops: enable SuggestExtensions: false diff --git a/.tool-versions b/.tool-versions index d6608a7..3ef02a3 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1 @@ -ruby 3.0.6 +ruby 3.1.5 diff --git a/Gemfile.lock b/Gemfile.lock index 8332cd0..abde97a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,9 +1,13 @@ PATH remote: . specs: - grumlin (1.2.0) - async-pool (~> 0.4.0) + grumlin (1.3.0) + async (~> 2.11.0) + async-http (~> 0.66.0) + async-io (~> 1.43.0) + async-pool (~> 0.6.0) async-websocket (~> 0.26.0) + console (~> 1.25.0) ibsciss-middleware (~> 0.4.0) oj (~> 3.16.0) retryable (~> 3.0.0) @@ -23,30 +27,31 @@ GEM mutex_m tzinfo (~> 2.0) ast (2.4.2) - async (1.31.0) - console (~> 1.10) - nio4r (~> 2.3) + async (2.11.0) + console (~> 1.25, >= 1.25.2) + fiber-annotation + io-event (~> 1.5, >= 1.5.1) timers (~> 4.1) - async-http (0.61.0) - async (>= 1.25) - async-io (>= 1.28) - async-pool (>= 0.2) - protocol-http (~> 0.25.0) - protocol-http1 (~> 0.16.0) - protocol-http2 (~> 0.15.0) + async-http (0.66.3) + async (>= 2.10.2) + async-pool (>= 0.6.1) + io-endpoint (~> 0.10, >= 0.10.3) + io-stream (~> 0.4) + protocol-http (~> 0.26.0) + protocol-http1 (~> 0.19.0) + protocol-http2 (~> 0.17.0) traces (>= 0.10.0) - async-io (1.38.1) + async-io (1.43.2) async - async-pool (0.4.0) + async-pool (0.6.1) async (>= 1.25) async-rspec (1.17.0) rspec (~> 3.0) rspec-files (~> 1.0) rspec-memory (~> 1.0) - async-websocket (0.26.0) + async-websocket (0.26.1) async-http (~> 0.54) - async-io (~> 1.23) - protocol-rack (~> 0.1) + protocol-rack (~> 0.5) protocol-websocket (~> 0.11) backport (1.2.0) base64 (0.2.0) @@ -56,9 +61,10 @@ GEM childprocess (4.1.0) concurrent-ruby (1.2.2) connection_pool (2.4.1) - console (1.23.3) + console (1.25.2) fiber-annotation - fiber-local + fiber-local (~> 1.1) + json dead_end (4.0.0) diff-lcs (1.5.0) docile (1.4.0) @@ -68,11 +74,16 @@ GEM factory_bot (6.4.5) activesupport (>= 5.0.0) fiber-annotation (0.2.0) - fiber-local (1.0.0) + fiber-local (1.1.0) + fiber-storage + fiber-storage (0.1.0) i18n (1.14.1) concurrent-ruby (~> 1.0) - ibsciss-middleware (0.4.2) + ibsciss-middleware (0.4.3) iniparse (1.5.0) + io-endpoint (0.10.3) + io-event (1.5.1) + io-stream (0.4.0) jaro_winkler (1.5.6) json (2.7.1) kramdown (2.4.0) @@ -84,7 +95,6 @@ GEM mini_portile2 (2.8.5) minitest (5.20.0) mutex_m (0.2.0) - nio4r (2.7.0) nokogiri (1.16.0) mini_portile2 (~> 2.8.2) racc (~> 1.4) @@ -100,20 +110,20 @@ GEM parser (3.2.2.4) ast (~> 2.4.1) racc - protocol-hpack (1.4.2) - protocol-http (0.25.0) - protocol-http1 (0.16.1) + protocol-hpack (1.4.3) + protocol-http (0.26.5) + protocol-http1 (0.19.1) protocol-http (~> 0.22) - protocol-http2 (0.15.1) + protocol-http2 (0.17.0) protocol-hpack (~> 1.4) protocol-http (~> 0.18) - protocol-rack (0.4.1) + protocol-rack (0.5.1) protocol-http (~> 0.23) rack (>= 1.0) protocol-websocket (0.12.1) protocol-http (~> 0.2) racc (1.7.3) - rack (3.0.8) + rack (3.0.11) rainbow (3.1.1) rake (13.1.0) rbs (2.8.4) @@ -196,7 +206,7 @@ GEM concurrent-ruby (~> 1.0) unicode-display_width (2.5.0) yard (0.9.34) - zeitwerk (2.6.12) + zeitwerk (2.6.14) PLATFORMS ruby diff --git a/README.md b/README.md index d4175ea..2004ae5 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ event loop. ## Dependencies -Grumlin works with ruby >= 3.0, but it's recommended to use 3.1 due to [zlib warnings](https://github.com/socketry/async-websocket/issues/42). +Grumlin works with ruby >= 3.1. ## Install diff --git a/grumlin.gemspec b/grumlin.gemspec index 1774a56..0889ed9 100644 --- a/grumlin.gemspec +++ b/grumlin.gemspec @@ -16,7 +16,7 @@ Gem::Specification.new do |spec| spec.homepage = "https://github.com/babbel/grumlin" spec.license = "MIT" - spec.required_ruby_version = Gem::Requirement.new(">= 3.0") + spec.required_ruby_version = Gem::Requirement.new(">= 3.1") spec.metadata["homepage_uri"] = spec.homepage spec.metadata["source_code_uri"] = "https://github.com/babbel/grumlin" @@ -28,8 +28,12 @@ Gem::Specification.new do |spec| end spec.require_paths = ["lib"] - spec.add_dependency "async-pool", "~> 0.4.0" + spec.add_dependency "async", "~> 2.11.0" + spec.add_dependency "async-http", "~> 0.66.0" + spec.add_dependency "async-io", "~> 1.43.0" + spec.add_dependency "async-pool", "~> 0.6.0" spec.add_dependency "async-websocket", "~> 0.26.0" + spec.add_dependency "console", "~> 1.25.0" spec.add_dependency "ibsciss-middleware", "~> 0.4.0" spec.add_dependency "oj", "~> 3.16.0" spec.add_dependency "retryable", "~> 3.0.0" diff --git a/lib/grumlin/client.rb b/lib/grumlin/client.rb index d499bd3..7078eca 100644 --- a/lib/grumlin/client.rb +++ b/lib/grumlin/client.rb @@ -38,8 +38,6 @@ def reusable? end end - include Console - # Client is not reusable. Once closed should be recreated. def initialize(url, parent: Async::Task.current, **client_options) @url = url @@ -62,7 +60,7 @@ def connect rescue Async::Stop, Async::TimeoutError, StandardError close(check_requests: false) end - logger.debug(self, "Connected") + Console.debug(self, "Connected") end # Before calling close the user must ensure that: @@ -85,7 +83,7 @@ def close(check_requests: true) # rubocop:disable Metrics/CyclomaticComplexity,M raise Grumlin::ResourceLeakError, "Request list is not empty: #{@request_dispatcher.requests}" if check_requests ensure - logger.debug(self, "Closed") + Console.debug(self, "Closed") end def connected? diff --git a/lib/grumlin/config.rb b/lib/grumlin/config.rb index 4f4594d..624f736 100644 --- a/lib/grumlin/config.rb +++ b/lib/grumlin/config.rb @@ -22,7 +22,7 @@ def initialize @pool_size = 10 @client_concurrency = 5 @provider = :tinkergraph - @client_factory = ->(url, parent) { Grumlin::Client.new(url, parent: parent) } + @client_factory = ->(url, parent) { Grumlin::Client.new(url, parent:) } end def middlewares diff --git a/lib/grumlin/dummy_transaction.rb b/lib/grumlin/dummy_transaction.rb index 67296cb..791bff1 100644 --- a/lib/grumlin/dummy_transaction.rb +++ b/lib/grumlin/dummy_transaction.rb @@ -3,13 +3,11 @@ class Grumlin::DummyTransaction < Grumlin::Transaction attr_reader :uuid - include Console - def initialize(traversal_start_class, middlewares:, pool:) super @session_id = nil - logger.info(self) do + Console.info(self) do "#{Grumlin.config.provider} does not support transactions. commit and rollback are ignored, data will be saved" end end diff --git a/lib/grumlin/repository/error_handling_strategy.rb b/lib/grumlin/repository/error_handling_strategy.rb index 8f60683..94879e2 100644 --- a/lib/grumlin/repository/error_handling_strategy.rb +++ b/lib/grumlin/repository/error_handling_strategy.rb @@ -19,11 +19,11 @@ def retry? @mode == :retry end - def apply!(&block) + def apply!(&) return yield if raise? - return ignore_errors!(&block) if ignore? + return ignore_errors!(&) if ignore? - retry_errors!(&block) + retry_errors!(&) end private @@ -34,7 +34,7 @@ def ignore_errors! # ignore errors end - def retry_errors!(&block) - Retryable.retryable(**@params, &block) + def retry_errors!(&) + Retryable.retryable(**@params, &) end end diff --git a/lib/grumlin/repository/instance_methods.rb b/lib/grumlin/repository/instance_methods.rb index 2f49c3f..c5addad 100644 --- a/lib/grumlin/repository/instance_methods.rb +++ b/lib/grumlin/repository/instance_methods.rb @@ -42,7 +42,7 @@ def drop_in_batches(traversal, batch_size: 10_000) # rubocop:disable Metrics/Abc return if traversal.count.next.zero? - drop_in_batches(traversal, batch_size: batch_size) + drop_in_batches(traversal, batch_size:) Console.logger.info(self) { "drop_in_batches: finished." } end @@ -123,17 +123,17 @@ def upsert_edges(edges, batch_size: 100, on_failure: :retry, start: g, **params) private - def with_upsert_error_handling(on_failure, params, &block) + def with_upsert_error_handling(on_failure, params, &) if params.any? Grumlin::Repository::ErrorHandlingStrategy.new(mode: on_failure, **UPSERT_RETRY_PARAMS.merge(params)) else DEFAULT_ERROR_HANDLING_STRATEGY - end.apply!(&block) + end.apply!(&) end - def with_upsert_retry(retry_params, &block) + def with_upsert_retry(retry_params, &) retry_params = UPSERT_RETRY_PARAMS.merge(retry_params) - Retryable.retryable(**retry_params, &block) + Retryable.retryable(**retry_params, &) end def cleanup_properties(create_properties, update_properties, *props_to_cleanup) diff --git a/lib/grumlin/request_dispatcher.rb b/lib/grumlin/request_dispatcher.rb index deb46ef..24adf49 100644 --- a/lib/grumlin/request_dispatcher.rb +++ b/lib/grumlin/request_dispatcher.rb @@ -23,7 +23,7 @@ def add_request(request) raise RequestAlreadyAddedError if @requests.include?(request[:requestId]) Async::Channel.new.tap do |channel| - @requests[request[:requestId]] = { request: request, result: [], channel: channel } + @requests[request[:requestId]] = { request:, result: [], channel: } end end diff --git a/lib/grumlin/shortcuts.rb b/lib/grumlin/shortcuts.rb index 009fe42..20d5420 100644 --- a/lib/grumlin/shortcuts.rb +++ b/lib/grumlin/shortcuts.rb @@ -21,7 +21,7 @@ def shortcut(name, shortcut = nil, override: false, lazy: true, &block) raise ArgumentError, "either shortcut or block must be passed" if [shortcut, block].count(&:nil?) != 1 - shortcuts.add(name, shortcut || Grumlin::Shortcut.new(name, lazy: lazy, &block)) + shortcuts.add(name, shortcut || Grumlin::Shortcut.new(name, lazy:, &block)) end def shortcuts_from(other_shortcuts) diff --git a/lib/grumlin/shortcuts/storage.rb b/lib/grumlin/shortcuts/storage.rb index 192700a..d0eeedf 100644 --- a/lib/grumlin/shortcuts/storage.rb +++ b/lib/grumlin/shortcuts/storage.rb @@ -35,7 +35,7 @@ def add(name, shortcut) sc = step_class shortcut_methods_module.define_method(name) do |*args, **params| - next sc.new(name, args: args, params: params, previous_step: self, pool: pool) + next sc.new(name, args:, params:, previous_step: self, pool:) end extend_traversal_classes(shortcut) unless shortcut.lazy? end @@ -47,7 +47,7 @@ def add_from(other) end def g(middlewares: Grumlin.default_middlewares) - traversal_start_class.new(pool: Grumlin.default_pool, middlewares: middlewares) + traversal_start_class.new(pool: Grumlin.default_pool, middlewares:) end def __ diff --git a/lib/grumlin/shortcuts_applyer.rb b/lib/grumlin/shortcuts_applyer.rb index 1545322..3d93c69 100644 --- a/lib/grumlin/shortcuts_applyer.rb +++ b/lib/grumlin/shortcuts_applyer.rb @@ -26,7 +26,7 @@ def process_steps(steps, shortcuts) # rubocop:disable Metrics/AbcSize args = step.args.map { |arg| call(arg) } shortcut = shortcuts[step.name] - next result << Grumlin::StepData.new(step.name, args: args, params: step.params) unless shortcut&.lazy? + next result << Grumlin::StepData.new(step.name, args:, params: step.params) unless shortcut&.lazy? t = shortcuts.__ step = shortcut.apply(t, *args, **step.params) diff --git a/lib/grumlin/step.rb b/lib/grumlin/step.rb index 31ac02e..ccf92ba 100644 --- a/lib/grumlin/step.rb +++ b/lib/grumlin/step.rb @@ -6,7 +6,7 @@ class Grumlin::Step < Grumlin::Steppable # TODO: replace pool, session_id and middlewares with a context? def initialize(name, args: [], params: {}, previous_step: nil, pool: nil, session_id: nil, # rubocop:disable Metrics/ParameterLists middlewares: Grumlin.default_middlewares) - super(pool: pool, session_id: session_id, middlewares: middlewares) + super(pool:, session_id:, middlewares:) @name = name.to_sym @args = args # TODO: add recursive validation: only json types or Step @@ -55,7 +55,7 @@ def inspect end def bytecode(no_return: false) - Grumlin::StepsSerializers::Bytecode.new(steps, no_return: no_return) + Grumlin::StepsSerializers::Bytecode.new(steps, no_return:) end def next @@ -85,7 +85,7 @@ def iterate def send_query(need_results:) @middlewares.call(traversal: self, - need_results: need_results, + need_results:, session_id: @session_id, pool: @pool) end diff --git a/lib/grumlin/steppable.rb b/lib/grumlin/steppable.rb index 42097e6..f0b0b04 100644 --- a/lib/grumlin/steppable.rb +++ b/lib/grumlin/steppable.rb @@ -23,13 +23,13 @@ def initialize(pool: nil, session_id: nil, middlewares: Grumlin.default_middlewa ALL_STEPS.each do |step| define_method step do |*args, **params| - shortcuts.step_class.new(step, args: args, params: params, previous_step: self, + shortcuts.step_class.new(step, args:, params:, previous_step: self, session_id: @session_id, pool: @pool, middlewares: @middlewares) end end def step(name, *args, **params) - shortcuts.step_class.new(name, args: args, params: params, previous_step: self, + shortcuts.step_class.new(name, args:, params:, previous_step: self, session_id: @session_id, pool: @pool, middlewares: @middlewares) end diff --git a/lib/grumlin/steps.rb b/lib/grumlin/steps.rb index 8f4c658..218184f 100644 --- a/lib/grumlin/steps.rb +++ b/lib/grumlin/steps.rb @@ -24,11 +24,9 @@ def initialize(shortcuts, configuration_steps: [], steps: []) end def add(name, args: [], params: {}, to: :end) - if CONFIGURATION_STEPS.include?(name) || name.to_sym == :tx - return add_configuration_step(name, args: args, params: params, to: to) - end + return add_configuration_step(name, args:, params:, to:) if CONFIGURATION_STEPS.include?(name) || name.to_sym == :tx - Grumlin::StepData.new(name, args: cast_arguments(args), params: params).tap do |step| + Grumlin::StepData.new(name, args: cast_arguments(args), params:).tap do |step| next @steps << step if to == :end next @steps.unshift(step) if to == :begin @@ -62,7 +60,7 @@ def shortcuts?(steps_ary) def add_configuration_step(name, args: [], params: {}, to: :end) raise ArgumentError, "cannot use configuration steps after start step was used" if @steps.any? && to == :end - Grumlin::StepData.new(name, args: cast_arguments(args), params: params).tap do |step| + Grumlin::StepData.new(name, args: cast_arguments(args), params:).tap do |step| next @configuration_steps << step if to == :end next @configuration_steps.unshift(step) if to == :begin diff --git a/lib/grumlin/transaction.rb b/lib/grumlin/transaction.rb index 7b9c09b..c3fa005 100644 --- a/lib/grumlin/transaction.rb +++ b/lib/grumlin/transaction.rb @@ -3,8 +3,6 @@ class Grumlin::Transaction attr_reader :session_id, :pool - include Console - COMMIT = Grumlin::Repository.new.g.step(:tx, :commit) ROLLBACK = Grumlin::Repository.new.g.step(:tx, :rollback) diff --git a/lib/grumlin/transport.rb b/lib/grumlin/transport.rb index 0d6b097..f085b33 100644 --- a/lib/grumlin/transport.rb +++ b/lib/grumlin/transport.rb @@ -4,8 +4,6 @@ class Grumlin::Transport # A transport based on https://github.com/socketry/async # and https://github.com/socketry/async-websocket - include Console - attr_reader :url # Transport is not reusable. Once closed should be recreated. @@ -26,7 +24,7 @@ def connect raise AlreadyConnectedError if connected? @connection = Async::WebSocket::Client.connect(Async::HTTP::Endpoint.parse(@url), **@client_options) - logger.debug(self) { "Connected to #{@url}." } + Console.debug(self) { "Connected to #{@url}." } @response_task = @parent.async { run_response_task } @@ -88,7 +86,7 @@ def run_request_task def with_guard yield rescue Async::Stop, Async::TimeoutError, StandardError => e - logger.debug(self) { "Guard error, closing." } + Console.debug(self) { "Guard error, closing." } begin @response_channel.exception(e) rescue Async::Channel::ChannelClosedError diff --git a/lib/grumlin/traversal_start.rb b/lib/grumlin/traversal_start.rb index 53db115..839797b 100644 --- a/lib/grumlin/traversal_start.rb +++ b/lib/grumlin/traversal_start.rb @@ -12,7 +12,7 @@ def tx # Pool should have size of 1 when working with session pool = Async::Pool::Controller.new(Grumlin::Client::PoolResource, limit: 1) - transaction = tx_class.new(self.class, pool: pool, middlewares: @middlewares) + transaction = tx_class.new(self.class, pool:, middlewares: @middlewares) return transaction unless block_given? result = nil diff --git a/lib/grumlin/traversal_strategies/options_strategy.rb b/lib/grumlin/traversal_strategies/options_strategy.rb index 58c0dfd..d90f7f3 100644 --- a/lib/grumlin/traversal_strategies/options_strategy.rb +++ b/lib/grumlin/traversal_strategies/options_strategy.rb @@ -2,6 +2,6 @@ class Grumlin::TraversalStrategies::OptionsStrategy < Grumlin::TypedValue def initialize(value) - super(type: "OptionsStrategy", value: value) + super(type: "OptionsStrategy", value:) end end diff --git a/lib/grumlin/version.rb b/lib/grumlin/version.rb index b67aa89..2a5f2fe 100644 --- a/lib/grumlin/version.rb +++ b/lib/grumlin/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Grumlin - VERSION = "1.2.0" + VERSION = "1.3.0" end diff --git a/spec/async/channel_spec.rb b/spec/async/channel_spec.rb index f8ab05b..964f71a 100644 --- a/spec/async/channel_spec.rb +++ b/spec/async/channel_spec.rb @@ -93,7 +93,7 @@ Async do n = 0 channel.each do |msg| - expect(msg).to eq(message[n]) + expect(msg).to eq(messages[n]) n += 1 end expect(channel).to be_closed diff --git a/spec/grumlin/repository/error_handling_strategy_spec.rb b/spec/grumlin/repository/error_handling_strategy_spec.rb index 86189c2..bdfd2c8 100644 --- a/spec/grumlin/repository/error_handling_strategy_spec.rb +++ b/spec/grumlin/repository/error_handling_strategy_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.describe Grumlin::Repository::ErrorHandlingStrategy do - let(:strategy) { described_class.new(mode: mode, **params) } + let(:strategy) { described_class.new(mode:, **params) } let(:params) { { on: [NameError] } } describe "#apply" do diff --git a/spec/grumlin/repository/instance_methods_spec.rb b/spec/grumlin/repository/instance_methods_spec.rb index f59387b..fe733aa 100644 --- a/spec/grumlin/repository/instance_methods_spec.rb +++ b/spec/grumlin/repository/instance_methods_spec.rb @@ -225,7 +225,7 @@ end describe "#add_edge" do - subject { repository.add_edge(:test_label, id, from: from, to: to, **properties) } + subject { repository.add_edge(:test_label, id, from:, to:, **properties) } let(:from) { 1 } let(:to) { 2 } @@ -275,7 +275,7 @@ end describe "#upsert_vertex" do - subject { repository.upsert_vertex(:test, id, create_properties: create_properties, update_properties: update_properties) } + subject { repository.upsert_vertex(:test, id, create_properties:, update_properties:) } let(:id) { 123 } let(:create_properties) { { key: :value } } @@ -337,7 +337,7 @@ end describe "#upsert_edge" do - subject { repository.upsert_edge(:test, from: from, to: to, create_properties: create_properties, update_properties: update_properties) } + subject { repository.upsert_edge(:test, from:, to:, create_properties:, update_properties:) } let(:create_properties) { { key: :value, T.id => 1234 } } let(:update_properties) { { another_key: :another_value } } diff --git a/spec/grumlin/repository_spec.rb b/spec/grumlin/repository_spec.rb index ae59c40..8731248 100644 --- a/spec/grumlin/repository_spec.rb +++ b/spec/grumlin/repository_spec.rb @@ -102,7 +102,7 @@ describe "#query" do context "when return_mode is passed" do - subject { repository_class.query(:test_query, return_mode: return_mode) { g.V } } + subject { repository_class.query(:test_query, return_mode:) { g.V } } context "when return mode is valid" do let(:return_mode) { :single } @@ -121,7 +121,7 @@ end context "when postprocess_with is passed" do - subject { repository_class.query(:test_query, postprocess_with: postprocess_with) { g.V } } + subject { repository_class.query(:test_query, postprocess_with:) { g.V } } context "when postprocess_with is a symbol" do let(:postprocess_with) { :present } @@ -160,7 +160,7 @@ extend Grumlin::Repository query :test_query do |color| - g.V.hasAll(color: color) + g.V.hasAll(color:) end end end @@ -181,7 +181,7 @@ extend Grumlin::Repository query(:test_query, return_mode: :single) do |color| - g.V.hasAll(color: color) + g.V.hasAll(color:) end end end @@ -195,7 +195,7 @@ extend Grumlin::Repository query(:test_query, return_mode: :none) do |color| - g.V.hasAll(color: color) + g.V.hasAll(color:) end end end @@ -215,7 +215,7 @@ extend Grumlin::Repository query(:test_query, return_mode: :traversal) do |color| - g.V.hasAll(color: color) + g.V.hasAll(color:) end end end @@ -229,7 +229,7 @@ extend Grumlin::Repository query(:test_query, return_mode: :list) do |color| - g.V.hasAll(color: color) + g.V.hasAll(color:) end end end @@ -247,7 +247,7 @@ extend Grumlin::Repository query(:test_query) do |color| - g.V.hasAll(color: color) + g.V.hasAll(color:) end end end @@ -265,7 +265,7 @@ extend Grumlin::Repository query(:test_query) do |color| - g.V.hasAll(color: color) + g.V.hasAll(color:) end end end diff --git a/spec/grumlin/request_dispatcher_spec.rb b/spec/grumlin/request_dispatcher_spec.rb index 2fb3aef..bdd73ce 100644 --- a/spec/grumlin/request_dispatcher_spec.rb +++ b/spec/grumlin/request_dispatcher_spec.rb @@ -163,7 +163,7 @@ end context "when status is 500" do - let(:response) { { requestId: 123, status: { code: 500, message: message } } } + let(:response) { { requestId: 123, status: { code: 500, message: } } } context "when vertex already exists" do let(:message) { "Vertex with id already exists: 1234" } diff --git a/spec/grumlin/request_error_factory_spec.rb b/spec/grumlin/request_error_factory_spec.rb index 17b387d..b06e9ac 100644 --- a/spec/grumlin/request_error_factory_spec.rb +++ b/spec/grumlin/request_error_factory_spec.rb @@ -13,7 +13,7 @@ end context "when status is 500" do - let(:response) { { requestId: 123, status: { code: 500, message: message } } } + let(:response) { { requestId: 123, status: { code: 500, message: } } } context "when vertex already exists" do let(:message) { "Vertex with id already exists: 1234" } diff --git a/spec/grumlin/step_spec.rb b/spec/grumlin/step_spec.rb index 68dc385..80850be 100644 --- a/spec/grumlin/step_spec.rb +++ b/spec/grumlin/step_spec.rb @@ -2,7 +2,7 @@ RSpec.describe Grumlin::Step do let(:step_class) { shortcuts.step_class } - let(:step) { step_class.new(name, args: args, params: params) } + let(:step) { step_class.new(name, args:, params:) } let(:name) { :V } let(:args) { [] } let(:params) { {} } diff --git a/spec/grumlin/steps_serializers/string_spec.rb b/spec/grumlin/steps_serializers/string_spec.rb index 8c06fa6..37b239f 100644 --- a/spec/grumlin/steps_serializers/string_spec.rb +++ b/spec/grumlin/steps_serializers/string_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.describe Grumlin::StepsSerializers::String, :gremlin do - let(:serializer) { described_class.new(steps, apply_shortcuts: apply_shortcuts) } + let(:serializer) { described_class.new(steps, apply_shortcuts:) } let(:shortcuts) do Grumlin::Shortcuts::Storage[ diff --git a/spec/grumlin/steps_spec.rb b/spec/grumlin/steps_spec.rb index ebf1a0b..92de6dd 100644 --- a/spec/grumlin/steps_spec.rb +++ b/spec/grumlin/steps_spec.rb @@ -14,7 +14,7 @@ end describe "#add" do - subject { steps.add(name, args: args) } + subject { steps.add(name, args:) } let(:args) { [] } let(:shortcuts) { Grumlin::Shortcuts::Storage.empty } diff --git a/spec/grumlin/stress_spec.rb b/spec/grumlin/stress_spec.rb index c2be541..c736efe 100644 --- a/spec/grumlin/stress_spec.rb +++ b/spec/grumlin/stress_spec.rb @@ -92,7 +92,7 @@ def random_query # rubocop:disable Metrics/AbcSize end reactor.sleep(duration) - barrier.tasks.each(&:stop) + barrier.tasks.each { _1.task.stop } barrier.wait end end diff --git a/spec/grumlin/traverser_spec.rb b/spec/grumlin/traverser_spec.rb index 16a0f5d..bd0f134 100644 --- a/spec/grumlin/traverser_spec.rb +++ b/spec/grumlin/traverser_spec.rb @@ -19,7 +19,7 @@ describe ".new" do subject { described_class.new(traverser_value) } - let(:traverser_value) { { bulk: bulk, value: value } } + let(:traverser_value) { { bulk:, value: } } let(:value) do { "@type": "g:Map", "@value": ["test2", { "@type": "g:List", "@value": [{ "@type": "g:Int32", "@value": 0 }] }, @@ -27,7 +27,7 @@ end context "when bulk is not specified" do - let(:traverser_value) { { value: value } } + let(:traverser_value) { { value: } } include_examples "builds a traverser", 1 end