From 709cfe3406e9ecdfcb3f53a2357800bf625bec36 Mon Sep 17 00:00:00 2001 From: Dimitris Christodoulou Date: Thu, 8 May 2025 17:05:12 +0100 Subject: [PATCH] Rubocop: Use traling comma for multi-line arguments --- .rubocop.yml | 3 ++ bin/fetch-stats | 2 +- examples/analytics.rb | 2 +- examples/managing_analytics_indexes.rb | 2 +- examples/managing_query_indexes.rb | 2 +- examples/range_scan.rb | 2 +- lib/active_support/cache/couchbase_store.rb | 2 +- lib/couchbase/cluster.rb | 2 +- lib/couchbase/collection.rb | 2 +- lib/couchbase/collection_options.rb | 4 +- .../management/analytics_index_manager.rb | 8 +-- lib/couchbase/protostellar/cluster.rb | 4 +- lib/couchbase/protostellar/collection.rb | 2 +- .../collection_query_index_manager.rb | 2 +- .../request_generator/admin/bucket.rb | 8 +-- .../request_generator/admin/collection.rb | 12 ++--- .../request_generator/admin/query.rb | 26 +++++----- .../protostellar/request_generator/kv.rb | 50 +++++++++---------- .../protostellar/request_generator/query.rb | 8 +-- .../protostellar/request_generator/search.rb | 50 +++++++++---------- .../protostellar/response_converter/search.rb | 2 +- lib/couchbase/protostellar/retry/reason.rb | 2 +- lib/couchbase/protostellar/timeouts.rb | 2 +- lib/couchbase/scope.rb | 2 +- lib/couchbase/transcoder_flags.rb | 2 +- lib/couchbase/utils/stdlib_logger_adapter.rb | 2 +- test/bucket_manager_test.rb | 12 ++--- test/collection_manager_test.rb | 8 +-- test/couchbase_test.rb | 2 +- test/query_index_manager_test.rb | 2 +- test/scan_test.rb | 48 +++++++++--------- test/scope_search_index_manager_test.rb | 4 +- test/subdoc_test.rb | 2 +- test/test_helper.rb | 2 +- 34 files changed, 144 insertions(+), 141 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 02659521..6ac12f0a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -47,5 +47,8 @@ Style/TrailingCommaInArrayLiteral: Style/TrailingCommaInHashLiteral: EnforcedStyleForMultiline: comma +Style/TrailingCommaInArguments: + EnforcedStyleForMultiline: comma + Layout/FirstHashElementIndentation: EnforcedStyle: consistent diff --git a/bin/fetch-stats b/bin/fetch-stats index f203b514..92512674 100755 --- a/bin/fetch-stats +++ b/bin/fetch-stats @@ -27,7 +27,7 @@ Net::HTTP.start("rubygems.org", use_ssl: true) do |client| puts JSON.pretty_generate( versions: stats, total: stats.values.sum, - total3: stats.filter_map { |version, downloads| downloads if version.match?(/^3.\d+.\d+/) }.sum + total3: stats.filter_map { |version, downloads| downloads if version.match?(/^3.\d+.\d+/) }.sum, ) end end diff --git a/examples/analytics.rb b/examples/analytics.rb index 7aa5bc04..4ec18dd9 100644 --- a/examples/analytics.rb +++ b/examples/analytics.rb @@ -182,7 +182,7 @@ puts "---- inner join" res = cluster.analytics_query( - "SELECT * FROM #{dataverse_name}.GleambookUsers u, #{dataverse_name}.GleambookMessages m WHERE m.authorId = u.id" + "SELECT * FROM #{dataverse_name}.GleambookUsers u, #{dataverse_name}.GleambookMessages m WHERE m.authorId = u.id", ) res.rows.each do |row| puts "#{row['u']['name']}: #{row['m']['message'].inspect}" diff --git a/examples/managing_analytics_indexes.rb b/examples/managing_analytics_indexes.rb index 05076cca..641dae54 100644 --- a/examples/managing_analytics_indexes.rb +++ b/examples/managing_analytics_indexes.rb @@ -30,7 +30,7 @@ def measure(msg) manager = cluster.analytics_indexes options = Management::Options::Analytics::DropDataset( ignore_if_does_not_exist: true, - dataverse_name: "beer-data" + dataverse_name: "beer-data", ) manager.drop_dataset("beers", options) manager.drop_dataset("breweries", options) diff --git a/examples/managing_query_indexes.rb b/examples/managing_query_indexes.rb index c9b3e7cb..e908299b 100644 --- a/examples/managing_query_indexes.rb +++ b/examples/managing_query_indexes.rb @@ -52,7 +52,7 @@ def display_indexes(indexes, bucket_name) cluster.query_indexes.create_index(bucket_name, index_name, %w[`type` `name`], Management::Options::Query::CreateIndex( ignore_if_exists: true, - condition: "abv > 2" + condition: "abv > 2", )) end diff --git a/examples/range_scan.rb b/examples/range_scan.rb index 5bcb833b..85991cdb 100644 --- a/examples/range_scan.rb +++ b/examples/range_scan.rb @@ -31,7 +31,7 @@ scan_type = RangeScan.new( from: ScanTerm.new("airline_1"), - to: ScanTerm.new("airline_11", exclusive: true) + to: ScanTerm.new("airline_11", exclusive: true), ) res = collection.scan(scan_type, options) diff --git a/lib/active_support/cache/couchbase_store.rb b/lib/active_support/cache/couchbase_store.rb index 8d9c13ad..514885bc 100644 --- a/lib/active_support/cache/couchbase_store.rb +++ b/lib/active_support/cache/couchbase_store.rb @@ -316,7 +316,7 @@ def build_cluster @couchbase_options[:connection_string], ::Couchbase::Options::Cluster(authenticator: ::Couchbase::PasswordAuthenticator.new( @couchbase_options[:username], @couchbase_options[:password] - )) + )), ) end diff --git a/lib/couchbase/cluster.rb b/lib/couchbase/cluster.rb index 139150e7..7f9ecae6 100644 --- a/lib/couchbase/cluster.rb +++ b/lib/couchbase/cluster.rb @@ -391,7 +391,7 @@ def convert_search_result(resp, options) location.end_offset = loc[:end_offset] location.array_positions = loc[:array_positions] end - end + end, ) end row.instance_variable_set(:@fields, r[:fields]) diff --git a/lib/couchbase/collection.rb b/lib/couchbase/collection.rb index 0b55feb7..8b87ed37 100644 --- a/lib/couchbase/collection.rb +++ b/lib/couchbase/collection.rb @@ -626,7 +626,7 @@ def scan(scan_type, options = Options::Scan::DEFAULT) core_scan_result: @backend.document_scan_create( @bucket_name, @scope_name, @name, scan_type.to_backend, options.to_backend ), - transcoder: options.transcoder + transcoder: options.transcoder, ) end diff --git a/lib/couchbase/collection_options.rb b/lib/couchbase/collection_options.rb index f85c5a18..c198a516 100644 --- a/lib/couchbase/collection_options.rb +++ b/lib/couchbase/collection_options.rb @@ -381,7 +381,7 @@ def each yield ScanResult.new( id: resp[:id], id_only: resp[:id_only], - transcoder: @transcoder + transcoder: @transcoder, ) else yield ScanResult.new( @@ -391,7 +391,7 @@ def each expiry: resp[:expiry], encoded: resp[:encoded], flags: resp[:flags], - transcoder: @transcoder + transcoder: @transcoder, ) end end diff --git a/lib/couchbase/management/analytics_index_manager.rb b/lib/couchbase/management/analytics_index_manager.rb index 5375c33f..65b0e1b2 100644 --- a/lib/couchbase/management/analytics_index_manager.rb +++ b/lib/couchbase/management/analytics_index_manager.rb @@ -846,7 +846,7 @@ def get_links(options = Options::Analytics::GetLinks.new) entry[:access_key_id], nil, entry[:region], - service_endpoint: entry[:service_endpoint] + service_endpoint: entry[:service_endpoint], ) when :couchbase CouchbaseRemoteAnalyticsLink.new( @@ -857,8 +857,8 @@ def get_links(options = Options::Analytics::GetLinks.new) encryption: EncryptionSettings.new( level: entry[:encryption_level], certificate: entry[:certificate], - client_certificate: entry[:client_certificate] - ) + client_certificate: entry[:client_certificate], + ), ) when :azureblob AzureBlobExternalAnalyticsLink.new( @@ -866,7 +866,7 @@ def get_links(options = Options::Analytics::GetLinks.new) entry[:dataverse], account_name: entry[:account_name], blob_endpoint: entry[:blob_endpoint], - endpoint_suffix: entry[:endpoint_suffix] + endpoint_suffix: entry[:endpoint_suffix], ) end end diff --git a/lib/couchbase/protostellar/cluster.rb b/lib/couchbase/protostellar/cluster.rb index eb1257a9..c4dd4526 100644 --- a/lib/couchbase/protostellar/cluster.rb +++ b/lib/couchbase/protostellar/cluster.rb @@ -95,7 +95,7 @@ def self.connect(connection_string_or_config, *args) username: username, password: password, timeouts: Protostellar::Timeouts.from_cluster_options(options), - root_certificates: params.key?("trust_certificate") ? File.read(params["trust_certificate"]) : nil + root_certificates: params.key?("trust_certificate") ? File.read(params["trust_certificate"]) : nil, ) new(connection_string.split("://")[1].split("?")[0], connect_options) end @@ -160,7 +160,7 @@ def initialize(host, options = ConnectOptions.new) credentials: options.grpc_credentials, channel_args: options.grpc_channel_args, call_metadata: options.grpc_call_metadata, - timeouts: options.timeouts + timeouts: options.timeouts, ) @query_request_generator = RequestGenerator::Query.new diff --git a/lib/couchbase/protostellar/collection.rb b/lib/couchbase/protostellar/collection.rb index ace73fa2..237cb0fb 100644 --- a/lib/couchbase/protostellar/collection.rb +++ b/lib/couchbase/protostellar/collection.rb @@ -49,7 +49,7 @@ def query_indexes client: @client, bucket_name: @bucket_name, scope_name: @scope_name, - collection_name: @name + collection_name: @name, ) end diff --git a/lib/couchbase/protostellar/management/collection_query_index_manager.rb b/lib/couchbase/protostellar/management/collection_query_index_manager.rb index aa8deb52..9c6cab41 100644 --- a/lib/couchbase/protostellar/management/collection_query_index_manager.rb +++ b/lib/couchbase/protostellar/management/collection_query_index_manager.rb @@ -29,7 +29,7 @@ def initialize(client:, bucket_name:, scope_name:, collection_name:) @scope_name = scope_name @collection_name = collection_name @request_generator = RequestGenerator::Admin::Query.new( - bucket_name: @bucket_name, scope_name: @scope_name, collection_name: @collection_name + bucket_name: @bucket_name, scope_name: @scope_name, collection_name: @collection_name, ) end diff --git a/lib/couchbase/protostellar/request_generator/admin/bucket.rb b/lib/couchbase/protostellar/request_generator/admin/bucket.rb index 629872d9..5edc8805 100644 --- a/lib/couchbase/protostellar/request_generator/admin/bucket.rb +++ b/lib/couchbase/protostellar/request_generator/admin/bucket.rb @@ -62,21 +62,21 @@ def list_buckets_request(options) def create_bucket_request(settings, options) proto_req = Generated::Admin::Bucket::V1::CreateBucketRequest.new( - extract_bucket_settings(settings, create: true) + extract_bucket_settings(settings, create: true), ) create_request(proto_req, :create_bucket, options) end def update_bucket_request(settings, options) proto_req = Generated::Admin::Bucket::V1::UpdateBucketRequest.new( - extract_bucket_settings(settings, create: false) + extract_bucket_settings(settings, create: false), ) create_request(proto_req, :update_bucket, options) end def delete_bucket_request(bucket_name, options) proto_req = Generated::Admin::Bucket::V1::DeleteBucketRequest.new( - bucket_name: bucket_name + bucket_name: bucket_name, ) create_request(proto_req, :delete_bucket, options) end @@ -114,7 +114,7 @@ def create_request(proto_request, rpc, options, idempotent: false) rpc: rpc, proto_request: proto_request, idempotent: idempotent, - timeout: options.timeout + timeout: options.timeout, ) end end diff --git a/lib/couchbase/protostellar/request_generator/admin/collection.rb b/lib/couchbase/protostellar/request_generator/admin/collection.rb index 5f5d7369..2e8efc16 100644 --- a/lib/couchbase/protostellar/request_generator/admin/collection.rb +++ b/lib/couchbase/protostellar/request_generator/admin/collection.rb @@ -30,7 +30,7 @@ def initialize(bucket_name:) def list_collections_request(options) proto_req = Generated::Admin::Collection::V1::ListCollectionsRequest.new( - bucket_name: @bucket_name + bucket_name: @bucket_name, ) create_request(proto_req, :list_collections, options, idempotent: true) end @@ -38,7 +38,7 @@ def list_collections_request(options) def create_scope_request(scope_name, options) proto_req = Generated::Admin::Collection::V1::CreateScopeRequest.new( bucket_name: @bucket_name, - scope_name: scope_name + scope_name: scope_name, ) create_request(proto_req, :create_scope, options) end @@ -46,7 +46,7 @@ def create_scope_request(scope_name, options) def delete_scope_request(scope_name, options) proto_req = Generated::Admin::Collection::V1::DeleteScopeRequest.new( bucket_name: @bucket_name, - scope_name: scope_name + scope_name: scope_name, ) create_request(proto_req, :delete_scope, options) end @@ -62,7 +62,7 @@ def create_collection_request(scope_name, collection_name, settings, options) bucket_name: @bucket_name, scope_name: scope_name, collection_name: collection_name, - **proto_opts + **proto_opts, ) create_request(proto_req, :create_collection, options) end @@ -71,7 +71,7 @@ def delete_collection_request(scope_name, collection_name, options) proto_req = Generated::Admin::Collection::V1::DeleteCollectionRequest.new( bucket_name: @bucket_name, scope_name: scope_name, - collection_name: collection_name + collection_name: collection_name, ) create_request(proto_req, :delete_collection, options) end @@ -84,7 +84,7 @@ def create_request(proto_request, rpc, options, idempotent: false) rpc: rpc, proto_request: proto_request, idempotent: idempotent, - timeout: options.timeout + timeout: options.timeout, ) end end diff --git a/lib/couchbase/protostellar/request_generator/admin/query.rb b/lib/couchbase/protostellar/request_generator/admin/query.rb index aba987ac..25370247 100644 --- a/lib/couchbase/protostellar/request_generator/admin/query.rb +++ b/lib/couchbase/protostellar/request_generator/admin/query.rb @@ -31,8 +31,8 @@ def initialize(bucket_name: nil, scope_name: nil, collection_name: nil) def get_all_indexes_request(options, bucket_name = nil) proto_req = Generated::Admin::Query::V1::GetAllIndexesRequest.new( **location( - bucket_name: bucket_name, scope_name: options.scope_name, collection_name: options.collection_name - ) + bucket_name: bucket_name, scope_name: options.scope_name, collection_name: options.collection_name, + ), ) create_request(proto_req, :get_all_indexes, options, idempotent: true) @@ -47,9 +47,9 @@ def create_primary_index_request(options, bucket_name = nil) proto_req = Generated::Admin::Query::V1::CreatePrimaryIndexRequest.new( **location( - bucket_name: bucket_name, scope_name: options.scope_name, collection_name: options.collection_name + bucket_name: bucket_name, scope_name: options.scope_name, collection_name: options.collection_name, ), - **proto_opts + **proto_opts, ) create_request(proto_req, :create_primary_index, options) @@ -63,11 +63,11 @@ def create_index_request(index_name, fields, options, bucket_name = nil) proto_req = Generated::Admin::Query::V1::CreateIndexRequest.new( **location( - bucket_name: bucket_name, scope_name: options.scope_name, collection_name: options.collection_name + bucket_name: bucket_name, scope_name: options.scope_name, collection_name: options.collection_name, ), name: index_name, fields: fields, - **proto_opts + **proto_opts, ) create_request(proto_req, :create_index, options) @@ -76,8 +76,8 @@ def create_index_request(index_name, fields, options, bucket_name = nil) def drop_primary_index_request(options, bucket_name = nil) proto_req = Generated::Admin::Query::V1::DropPrimaryIndexRequest.new( **location( - bucket_name: bucket_name, scope_name: options.scope_name, collection_name: options.collection_name - ) + bucket_name: bucket_name, scope_name: options.scope_name, collection_name: options.collection_name, + ), ) create_request(proto_req, :drop_primary_index, options) @@ -86,9 +86,9 @@ def drop_primary_index_request(options, bucket_name = nil) def drop_index_request(index_name, options, bucket_name = nil) proto_req = Generated::Admin::Query::V1::DropIndexRequest.new( **location( - bucket_name: bucket_name, scope_name: options.scope_name, collection_name: options.collection_name + bucket_name: bucket_name, scope_name: options.scope_name, collection_name: options.collection_name, ), - name: index_name + name: index_name, ) create_request(proto_req, :drop_index, options) @@ -97,8 +97,8 @@ def drop_index_request(index_name, options, bucket_name = nil) def build_deferred_indexes_request(options, bucket_name = nil) proto_req = Generated::Admin::Query::V1::BuildDeferredIndexesRequest.new( **location( - bucket_name: bucket_name, scope_name: options.scope_name, collection_name: options.collection_name - ) + bucket_name: bucket_name, scope_name: options.scope_name, collection_name: options.collection_name, + ), ) create_request(proto_req, :build_deferred_indexes, options) @@ -120,7 +120,7 @@ def create_request(proto_request, rpc, options, idempotent: false) rpc: rpc, proto_request: proto_request, idempotent: idempotent, - timeout: options.timeout + timeout: options.timeout, ) end end diff --git a/lib/couchbase/protostellar/request_generator/kv.rb b/lib/couchbase/protostellar/request_generator/kv.rb index 440b3618..6f437db8 100644 --- a/lib/couchbase/protostellar/request_generator/kv.rb +++ b/lib/couchbase/protostellar/request_generator/kv.rb @@ -86,7 +86,7 @@ def get_request(id, options) proto_req = Generated::KV::V1::GetRequest.new( key: id, **location, - **proto_opts + **proto_opts, ) create_kv_request(proto_req, :get, options, idempotent: true) @@ -100,7 +100,7 @@ def get_and_touch_request(id, expiry, options) proto_req = Generated::KV::V1::GetAndTouchRequest.new( **{expiry_type => expiry_value}, **location, - key: id + key: id, ) create_kv_request(proto_req, :get_and_touch, options) @@ -110,7 +110,7 @@ def get_and_lock_request(id, lock_time, options) proto_req = Generated::KV::V1::GetAndLockRequest.new( **location, key: id, - lock_time: lock_time.respond_to?(:in_seconds) ? lock_time.in_seconds : lock_time + lock_time: lock_time.respond_to?(:in_seconds) ? lock_time.in_seconds : lock_time, ) create_kv_request(proto_req, :get_and_lock, options) @@ -120,7 +120,7 @@ def unlock_request(id, cas, options) proto_req = Generated::KV::V1::UnlockRequest.new( **location, key: id, - cas: cas + cas: cas, ) create_kv_request(proto_req, :unlock, options) @@ -134,7 +134,7 @@ def touch_request(id, expiry, options) proto_req = Generated::KV::V1::TouchRequest.new( **{expiry_type => expiry_value}, **location, - key: id + key: id, ) create_kv_request(proto_req, :touch, options) @@ -156,7 +156,7 @@ def upsert_request(id, content, options) key: id, content_uncompressed: encoded, **location, - **proto_opts + **proto_opts, ) create_kv_request(proto_req, :upsert, options) @@ -177,7 +177,7 @@ def insert_request(id, content, options) key: id, content_uncompressed: encoded, **location, - **proto_opts + **proto_opts, ) create_kv_request(proto_req, :insert, options) @@ -202,7 +202,7 @@ def replace_request(id, content, options) key: id, content_uncompressed: encoded, **location, - **proto_opts + **proto_opts, ) create_kv_request(proto_req, :replace, options) @@ -217,7 +217,7 @@ def remove_request(id, options) proto_req = Generated::KV::V1::RemoveRequest.new( key: id, **location, - **proto_opts + **proto_opts, ) create_kv_request(proto_req, :remove, options) @@ -229,7 +229,7 @@ def exists_request(id, options) proto_req = Generated::KV::V1::ExistsRequest.new( key: id, **proto_opts, - **location + **location, ) create_kv_request(proto_req, :exists, options) @@ -256,7 +256,7 @@ def mutate_in_request(id, specs, options) key: id, **location, specs: specs.map { |s| get_mutate_in_spec(s) }, - **proto_opts + **proto_opts, ) create_kv_request(proto_req, :mutate_in, options) @@ -271,7 +271,7 @@ def lookup_in_request(id, specs, options) key: id, **location, specs: specs.map { |s| get_lookup_in_spec(s) }, - **proto_opts + **proto_opts, ) create_kv_request(proto_req, :lookup_in, options, idempotent: true) @@ -288,7 +288,7 @@ def increment_request(id, options) proto_req = Generated::KV::V1::IncrementRequest.new( key: id, **location, - **proto_opts + **proto_opts, ) create_kv_request(proto_req, :increment, options) @@ -305,7 +305,7 @@ def decrement_request(id, options) proto_req = Generated::KV::V1::DecrementRequest.new( key: id, **location, - **proto_opts + **proto_opts, ) create_kv_request(proto_req, :decrement, options) @@ -320,7 +320,7 @@ def append_request(id, content, options) key: id, content: content, **location, - **proto_opts + **proto_opts, ) create_kv_request(proto_req, :append, options) @@ -335,7 +335,7 @@ def prepend_request(id, content, options) key: id, content: content, **location, - **proto_opts + **proto_opts, ) create_kv_request(proto_req, :prepend, options) @@ -344,7 +344,7 @@ def prepend_request(id, content, options) def get_all_replicas_request(id, options) proto_req = Generated::KV::V1::GetAllReplicasRequest.new( key: id, - **location + **location, ) create_kv_request(proto_req, :get_all_replicas, options, idempotent: true) @@ -363,7 +363,7 @@ def create_kv_request(proto_request, rpc, options, idempotent: false) rpc: rpc, proto_request: proto_request, timeout: options.timeout, - idempotent: idempotent + idempotent: idempotent, ) end @@ -385,7 +385,7 @@ def get_expiry(options_or_expiry) [:expiry_secs, time_or_duration] when :time_point timestamp = Google::Protobuf::Timestamp.new( - seconds: time_or_duration + seconds: time_or_duration, ) [:expiry_time, timestamp] else @@ -405,7 +405,7 @@ def get_lookup_in_spec(lookup_in_spec) Generated::KV::V1::LookupInRequest::Spec.new( operation: get_lookup_in_operation(lookup_in_spec), path: lookup_in_spec.path, - flags: get_lookup_in_spec_flags(lookup_in_spec) + flags: get_lookup_in_spec_flags(lookup_in_spec), ) end @@ -415,13 +415,13 @@ def get_lookup_in_operation(lookup_in_spec) def get_lookup_in_spec_flags(lookup_in_spec) Generated::KV::V1::LookupInRequest::Spec::Flags.new( - xattr: lookup_in_spec.xattr? + xattr: lookup_in_spec.xattr?, ) end def get_lookup_in_flags(options) Generated::KV::V1::LookupInRequest::Flags.new( - access_deleted: options.access_deleted + access_deleted: options.access_deleted, ) end @@ -434,7 +434,7 @@ def get_mutate_in_spec(mutate_in_spec) operation: get_mutate_in_operation(mutate_in_spec), path: mutate_in_spec.path, content: mutate_in_spec.param.to_s, - flags: get_mutate_in_spec_flags(mutate_in_spec) + flags: get_mutate_in_spec_flags(mutate_in_spec), ) end @@ -445,13 +445,13 @@ def get_mutate_in_operation(mutate_in_spec) def get_mutate_in_spec_flags(mutate_in_spec) Generated::KV::V1::MutateInRequest::Spec::Flags.new( create_path: mutate_in_spec.create_path?, - xattr: mutate_in_spec.xattr? + xattr: mutate_in_spec.xattr?, ) end def get_mutate_in_flags(options) Generated::KV::V1::MutateInRequest::Flags.new( - access_deleted: options.access_deleted + access_deleted: options.access_deleted, ) end diff --git a/lib/couchbase/protostellar/request_generator/query.rb b/lib/couchbase/protostellar/request_generator/query.rb index c21f0620..f9219c05 100644 --- a/lib/couchbase/protostellar/request_generator/query.rb +++ b/lib/couchbase/protostellar/request_generator/query.rb @@ -78,7 +78,7 @@ def query_request(statement, options) proto_req = Generated::Query::V1::QueryRequest.new( statement: statement, - **proto_opts + **proto_opts, ) create_query_request(proto_req, :query, options, idempotent: options.readonly) @@ -92,7 +92,7 @@ def create_query_request(proto_request, rpc, options, idempotent: false) rpc: rpc, proto_request: proto_request, timeout: options.timeout, - idempotent: idempotent + idempotent: idempotent, ) end @@ -105,7 +105,7 @@ def create_tuning_options(options) duration_millis = Utils::Time.extract_duration(options.scan_wait) tuning_opts[:scan_wait] = Google::Protobuf::Duration.new( seconds: duration_millis / 1000, - nanos: (duration_millis % 1000) * (10**6) + nanos: (duration_millis % 1000) * (10**6), ) end tuning_opts[:scan_cap] = options.scan_cap unless options.scan_cap.nil? @@ -123,7 +123,7 @@ def get_consistent_with(options) bucket_name: t.bucket_name, vbucket_id: t.partition_id, vbucket_uuid: t.partition_uuid, - seq_no: t.sequence_number + seq_no: t.sequence_number, ) end end diff --git a/lib/couchbase/protostellar/request_generator/search.rb b/lib/couchbase/protostellar/request_generator/search.rb index 67fc848c..d2e2776f 100644 --- a/lib/couchbase/protostellar/request_generator/search.rb +++ b/lib/couchbase/protostellar/request_generator/search.rb @@ -62,7 +62,7 @@ def search_query_request(index_name, query, options) proto_req = Generated::Search::V1::SearchQueryRequest.new( query: create_query(query), index_name: index_name, - **proto_opts + **proto_opts, ) # Set the search facets in the request @@ -81,7 +81,7 @@ def create_search_request(proto_request, rpc, options, idempotent: false) rpc: rpc, proto_request: proto_request, timeout: options.timeout, - idempotent: idempotent + idempotent: idempotent, ) end @@ -188,11 +188,11 @@ def create_geo_bounding_box_query(query) query_attrs = query.to_h query_attrs[:top_left] = Generated::Search::V1::LatLng.new( longitude: query_attrs[:top_left][0], - latitude: query_attrs[:top_left][1] + latitude: query_attrs[:top_left][1], ) query_attrs[:bottom_right] = Generated::Search::V1::LatLng.new( longitude: query_attrs[:bottom_right][0], - latitude: query_attrs[:bottom_right][1] + latitude: query_attrs[:bottom_right][1], ) Generated::Search::V1::GeoBoundingBoxQuery.new(query_attrs) end @@ -202,7 +202,7 @@ def create_geo_distance_query(query) longitude, latitude = query_attrs.delete(:location) query_attrs[:center] = Generated::Search::V1::LatLng.new( longitude: longitude, - latitude: latitude + latitude: latitude, ) Generated::Search::V1::GeoDistanceQuery.new(query_attrs) end @@ -213,7 +213,7 @@ def create_geo_polygon_query(query) query_attrs[:vertices] = polygon_points.map do |lon, lat| Generated::Search::V1::LatLng.new( longitude: lon, - latitude: lat + latitude: lat, ) end Generated::Search::V1::GeoPolygonQuery.new(query_attrs) @@ -288,20 +288,20 @@ def get_sort(options) descending: s.desc, missing: s.missing.to_s, mode: s.mode.to_s, - type: s.type.to_s - ) + type: s.type.to_s, + ), ) when Couchbase::Cluster::SearchSort::SearchSortId Generated::Search::V1::Sorting.new( id_sorting: Generated::Search::V1::IdSorting.new( - descending: s.desc - ) + descending: s.desc, + ), ) when Couchbase::Cluster::SearchSort::SearchSortScore Generated::Search::V1::Sorting.new( score_sorting: Generated::Search::V1::ScoreSorting.new( - descending: s.desc - ) + descending: s.desc, + ), ) when Couchbase::Cluster::SearchSort::SearchSortGeoDistance Generated::Search::V1::Sorting.new( @@ -310,10 +310,10 @@ def get_sort(options) descending: s.desc, center: Generated::Search::V1::LatLng.new( latitude: s.latitude, - longitude: s.longitude + longitude: s.longitude, ), - unit: s.unit.to_s - ) + unit: s.unit.to_s, + ), ) when String if s[0] == "-" @@ -326,16 +326,16 @@ def get_sort(options) if field == "_score" Generated::Search::V1::Sorting.new( score_sorting: Generated::Search::V1::ScoreSorting.new( - descending: desc - ) + descending: desc, + ), ) else Generated::Search::V1::Sorting.new( # TODO: What to do with the rest of the FieldSorting attributes? core_sorting: Generated::Search::V1::FieldSorting.new( field: field, - descending: desc - ) + descending: desc, + ), ) end else @@ -353,8 +353,8 @@ def get_facets(options) Generated::Search::V1::Facet.new( term_facet: Generated::Search::V1::TermFacet.new( field: facet.field, - size: facet.size - ) + size: facet.size, + ), ) when Couchbase::Cluster::SearchFacet::SearchFacetNumericRange Generated::Search::V1::Facet.new( @@ -363,8 +363,8 @@ def get_facets(options) size: facet.size, numeric_ranges: facet.instance_variable_get(:@ranges).map do |r| Generated::Search::V1::NumericRange(name: r[:name], min: r[:min], max: r[:max]) - end - ) + end, + ), ) when Couchbase::Cluster::SearchFacet::SearchFacetDateRange Generated::Search::V1::Facet.new( @@ -373,8 +373,8 @@ def get_facets(options) size: facet.size, date_ranges: facet.instance_variable_get(:@ranges).map do |r| Generated::Search::V1::DateRange(name: r[:name], start: r[:start], end: r[:end]) - end - ) + end, + ), ) else raise Couchbase::Error::CouchbaseError, "Unrecognised search facet type" diff --git a/lib/couchbase/protostellar/response_converter/search.rb b/lib/couchbase/protostellar/response_converter/search.rb index 4b4e4d03..216e36a1 100644 --- a/lib/couchbase/protostellar/response_converter/search.rb +++ b/lib/couchbase/protostellar/response_converter/search.rb @@ -45,7 +45,7 @@ def self.convert_search_row(proto_row, options) r.score = proto_row.score.to_f unless proto_row.locations.empty? r.locations = Couchbase::Cluster::SearchRowLocations.new( - proto_row.locations.map { |loc| convert_search_row_location(loc) } + proto_row.locations.map { |loc| convert_search_row_location(loc) }, ) end r.fragments = convert_fragments(proto_row.fragments) diff --git a/lib/couchbase/protostellar/retry/reason.rb b/lib/couchbase/protostellar/retry/reason.rb index 700be8ec..e55dd6cc 100644 --- a/lib/couchbase/protostellar/retry/reason.rb +++ b/lib/couchbase/protostellar/retry/reason.rb @@ -27,7 +27,7 @@ def self.reason(name, allows_non_idempotent_retry:, always_retry:) name, new(name: name, allows_non_idempotent_retry: allows_non_idempotent_retry, - always_retry: always_retry).freeze + always_retry: always_retry).freeze, ) end diff --git a/lib/couchbase/protostellar/timeouts.rb b/lib/couchbase/protostellar/timeouts.rb index a578aa21..062be025 100644 --- a/lib/couchbase/protostellar/timeouts.rb +++ b/lib/couchbase/protostellar/timeouts.rb @@ -75,7 +75,7 @@ def self.from_cluster_options(options) query_timeout: options.query_timeout, analytics_timeout: options.analytics_timeout, search_timeout: options.search_timeout, - management_timeout: options.management_timeout + management_timeout: options.management_timeout, ) end end diff --git a/lib/couchbase/scope.rb b/lib/couchbase/scope.rb index eee4c3a6..52703c18 100644 --- a/lib/couchbase/scope.rb +++ b/lib/couchbase/scope.rb @@ -198,7 +198,7 @@ def convert_search_result(resp, options) location.end_offset = loc[:end_offset] location.array_positions = loc[:array_positions] end - end + end, ) end row.instance_variable_set(:@fields, r[:fields]) diff --git a/lib/couchbase/transcoder_flags.rb b/lib/couchbase/transcoder_flags.rb index 0edad1c1..21a6c7ae 100644 --- a/lib/couchbase/transcoder_flags.rb +++ b/lib/couchbase/transcoder_flags.rb @@ -52,7 +52,7 @@ def self.decode(flags) TranscoderFlags.new( format: INV_FORMAT_MAP[format_bits], compression: INV_COMPRESSION_MAP[compression_bits], - lower_bits: lower_bits + lower_bits: lower_bits, ) end diff --git a/lib/couchbase/utils/stdlib_logger_adapter.rb b/lib/couchbase/utils/stdlib_logger_adapter.rb index 5c495b65..3696f656 100644 --- a/lib/couchbase/utils/stdlib_logger_adapter.rb +++ b/lib/couchbase/utils/stdlib_logger_adapter.rb @@ -39,7 +39,7 @@ def log(level, thread_id, seconds, nanoseconds, payload, filename, line, functio payload += " at #{filename}:#{line} #{function}" if @verbose && filename logdev.write( @logger.send(:format_message, @logger.send(:format_severity, severity), ::Time.at(seconds, nanoseconds, :nanosecond), progname, - payload) + payload), ) end diff --git a/test/bucket_manager_test.rb b/test/bucket_manager_test.rb index e3f7848e..9de42cf3 100644 --- a/test/bucket_manager_test.rb +++ b/test/bucket_manager_test.rb @@ -54,7 +54,7 @@ def test_create_bucket_history_retention s.history_retention_collection_default = false s.history_retention_bytes = 2147483648 s.history_retention_duration = 600 - end + end, ) env.consistency.wait_until_bucket_present(bucket_name) @@ -79,7 +79,7 @@ def test_create_bucket_history_retention_unsupported s.history_retention_collection_default = false s.history_retention_bytes = 2**31 s.history_retention_duration = 600 - end + end, ) end end @@ -94,7 +94,7 @@ def test_update_bucket_history_retention s.name = bucket_name s.storage_backend = :magma s.ram_quota_mb = 1024 - end + end, ) env.consistency.wait_until_bucket_present(bucket_name) @@ -113,7 +113,7 @@ def test_update_bucket_history_retention s.history_retention_collection_default = false s.history_retention_bytes = 2147483648 s.history_retention_duration = 600 - end + end, ) res = @bucket_manager.get_bucket(bucket_name) @@ -131,7 +131,7 @@ def test_update_bucket_history_retention_unsupported Couchbase::Management::BucketSettings.new do |s| s.name = bucket_name s.storage_backend = :couchstore - end + end, ) env.consistency.wait_until_bucket_present(bucket_name) @@ -150,7 +150,7 @@ def test_update_bucket_history_retention_unsupported s.history_retention_collection_default = false s.history_retention_bytes = 2147483648 s.history_retention_duration = 600 - end + end, ) end end diff --git a/test/collection_manager_test.rb b/test/collection_manager_test.rb index 140870d8..6782bc50 100644 --- a/test/collection_manager_test.rb +++ b/test/collection_manager_test.rb @@ -29,7 +29,7 @@ def create_magma_bucket s.name = TEST_MAGMA_BUCKET_NAME s.storage_backend = :magma s.ram_quota_mb = 1024 - end + end, ) env.consistency.wait_until_bucket_present(TEST_MAGMA_BUCKET_NAME) @@ -646,7 +646,7 @@ def test_create_collection_deprecated spec.name = coll_name spec.scope_name = scope_name end, - Management::Options::Collection::CreateCollection.new(timeout: 80_000) + Management::Options::Collection::CreateCollection.new(timeout: 80_000), ) env.consistency.wait_until_collection_present(env.bucket, scope_name, coll_name) @@ -665,7 +665,7 @@ def test_drop_collection_deprecated Management::CollectionSpec.new do |spec| spec.name = coll_name spec.scope_name = scope_name - end + end, ) env.consistency.wait_until_collection_present(env.bucket, scope_name, coll_name) @@ -676,7 +676,7 @@ def test_drop_collection_deprecated spec.name = coll_name spec.scope_name = scope_name end, - Management::Options::Collection::DropCollection.new(timeout: 80_000) + Management::Options::Collection::DropCollection.new(timeout: 80_000), ) env.consistency.wait_until_collection_dropped(env.bucket, scope_name, coll_name) diff --git a/test/couchbase_test.rb b/test/couchbase_test.rb index e4320b52..b6bb5f1a 100644 --- a/test/couchbase_test.rb +++ b/test/couchbase_test.rb @@ -35,7 +35,7 @@ def test_it_can_use_configuration_with_connect 'username' => env.username, 'password' => env.password, }, - } + }, )) temp_file.flush diff --git a/test/query_index_manager_test.rb b/test/query_index_manager_test.rb index c4936538..c3c2aa2a 100644 --- a/test/query_index_manager_test.rb +++ b/test/query_index_manager_test.rb @@ -30,7 +30,7 @@ def setup Couchbase::Management::BucketSettings.new do |s| s.name = @bucket_name s.ram_quota_mb = 256 - end + end, ) env.consistency.wait_until_bucket_present(@bucket_name) env.consistency.wait_until_bucket_present_in_indexes(@bucket_name) diff --git a/test/scan_test.rb b/test/scan_test.rb index 3ec2bae7..41c955af 100644 --- a/test/scan_test.rb +++ b/test/scan_test.rb @@ -107,7 +107,7 @@ def test_simple_range_scan scan_result = @collection.scan( RangeScan.new( from: ScanTerm.new("#{@shared_prefix}-10"), - to: ScanTerm.new("#{@shared_prefix}-29") + to: ScanTerm.new("#{@shared_prefix}-29"), ), Options::Scan(mutation_state: @mutation_state) ) validate_scan(scan_result, expected_ids) @@ -124,7 +124,7 @@ def test_range_scan_exclusive_from scan_result = @collection.scan( RangeScan.new( from: ScanTerm.new("#{@shared_prefix}-10", exclusive: true), - to: ScanTerm.new("#{@shared_prefix}-29") + to: ScanTerm.new("#{@shared_prefix}-29"), ), Options::Scan(mutation_state: @mutation_state) ) validate_scan(scan_result, expected_ids) @@ -135,7 +135,7 @@ def test_range_scan_exclusive_to scan_result = @collection.scan( RangeScan.new( from: ScanTerm.new("#{@shared_prefix}-10", exclusive: false), - to: ScanTerm.new("#{@shared_prefix}-29", exclusive: true) + to: ScanTerm.new("#{@shared_prefix}-29", exclusive: true), ), Options::Scan(mutation_state: @mutation_state) ) validate_scan(scan_result, expected_ids) @@ -146,7 +146,7 @@ def test_range_scan_both_exclusive scan_result = @collection.scan( RangeScan.new( from: ScanTerm.new("#{@shared_prefix}-10", exclusive: true), - to: ScanTerm.new("#{@shared_prefix}-29", exclusive: true) + to: ScanTerm.new("#{@shared_prefix}-29", exclusive: true), ), Options::Scan(mutation_state: @mutation_state) ) validate_scan(scan_result, expected_ids) @@ -156,7 +156,7 @@ def test_range_scan_default_from expected_ids = (0..9).map { |i| "#{@shared_prefix}-0#{i}" } scan_result = @collection.scan( RangeScan.new( - to: ScanTerm.new("#{@shared_prefix}-09") + to: ScanTerm.new("#{@shared_prefix}-09"), ), Options::Scan(mutation_state: @mutation_state) ) validate_scan(scan_result, expected_ids) @@ -166,7 +166,7 @@ def test_range_scan_default_to expected_ids = (0..9).map { |i| "#{@shared_prefix}-9#{i}" } scan_result = @collection.scan( RangeScan.new( - from: ScanTerm.new("#{@shared_prefix}-90") + from: ScanTerm.new("#{@shared_prefix}-90"), ), Options::Scan(mutation_state: @mutation_state) ) validate_scan(scan_result, expected_ids) @@ -182,9 +182,9 @@ def test_range_scan_ids_only scan_result = @collection.scan( RangeScan.new( from: ScanTerm.new("#{@shared_prefix}-10"), - to: ScanTerm.new("#{@shared_prefix}-29") + to: ScanTerm.new("#{@shared_prefix}-29"), ), - Options::Scan.new(ids_only: true, mutation_state: @mutation_state) + Options::Scan.new(ids_only: true, mutation_state: @mutation_state), ) validate_scan(scan_result, expected_ids, ids_only: true) end @@ -194,9 +194,9 @@ def test_range_scan_explicitly_with_content scan_result = @collection.scan( RangeScan.new( from: ScanTerm.new("#{@shared_prefix}-10"), - to: ScanTerm.new("#{@shared_prefix}-29") + to: ScanTerm.new("#{@shared_prefix}-29"), ), - Options::Scan.new(ids_only: false, mutation_state: @mutation_state) + Options::Scan.new(ids_only: false, mutation_state: @mutation_state), ) validate_scan(scan_result, expected_ids) end @@ -226,9 +226,9 @@ def test_range_scan_batch_byte_limit scan_result = @collection.scan( RangeScan.new( from: ScanTerm.new("#{@shared_prefix}-10"), - to: ScanTerm.new("#{@shared_prefix}-29") + to: ScanTerm.new("#{@shared_prefix}-29"), ), - Options::Scan.new(batch_byte_limit: b, mutation_state: @mutation_state) + Options::Scan.new(batch_byte_limit: b, mutation_state: @mutation_state), ) validate_scan(scan_result, expected_ids) end @@ -259,9 +259,9 @@ def test_range_scan_concurrency scan_result = @collection.scan( RangeScan.new( from: ScanTerm.new("#{@shared_prefix}-10"), - to: ScanTerm.new("#{@shared_prefix}-29") + to: ScanTerm.new("#{@shared_prefix}-29"), ), - Options::Scan.new(concurrency: c, mutation_state: @mutation_state) + Options::Scan.new(concurrency: c, mutation_state: @mutation_state), ) validate_scan(scan_result, expected_ids) end @@ -294,9 +294,9 @@ def test_range_scan_batch_item_limit scan_result = @collection.scan( RangeScan.new( from: ScanTerm.new("#{@shared_prefix}-10"), - to: ScanTerm.new("#{@shared_prefix}-29") + to: ScanTerm.new("#{@shared_prefix}-29"), ), - Options::Scan.new(batch_item_limit: b, mutation_state: @mutation_state) + Options::Scan.new(batch_item_limit: b, mutation_state: @mutation_state), ) validate_scan(scan_result, expected_ids) end @@ -324,9 +324,9 @@ def test_range_scan_multiple_options scan_result = @collection.scan( RangeScan.new( from: ScanTerm.new("#{@shared_prefix}-10"), - to: ScanTerm.new("#{@shared_prefix}-29") + to: ScanTerm.new("#{@shared_prefix}-29"), ), - Options::Scan.new(batch_byte_limit: 100, batch_item_limit: 20, ids_only: false, mutation_state: @mutation_state) + Options::Scan.new(batch_byte_limit: 100, batch_item_limit: 20, ids_only: false, mutation_state: @mutation_state), ) validate_scan(scan_result, expected_ids) end @@ -344,9 +344,9 @@ def test_range_scan_same_from_to scan_result = @collection.scan( RangeScan.new( from: ScanTerm.new("#{@shared_prefix}-10"), - to: ScanTerm.new("#{@shared_prefix}-10") + to: ScanTerm.new("#{@shared_prefix}-10"), ), - Options::Scan.new(mutation_state: @mutation_state) + Options::Scan.new(mutation_state: @mutation_state), ) validate_scan(scan_result, expected_ids) end @@ -356,9 +356,9 @@ def test_range_scan_same_from_to_exclusive scan_result = @collection.scan( RangeScan.new( from: ScanTerm.new("#{@shared_prefix}-10", exclusive: true), - to: ScanTerm.new("#{@shared_prefix}-10", exclusive: true) + to: ScanTerm.new("#{@shared_prefix}-10", exclusive: true), ), - Options::Scan.new(mutation_state: @mutation_state) + Options::Scan.new(mutation_state: @mutation_state), ) validate_scan(scan_result, expected_ids) end @@ -368,9 +368,9 @@ def test_range_scan_inverted_bounds scan_result = @collection.scan( RangeScan.new( from: ScanTerm.new("#{@shared_prefix}-20", exclusive: true), - to: ScanTerm.new("#{@shared_prefix}-10", exclusive: true) + to: ScanTerm.new("#{@shared_prefix}-10", exclusive: true), ), - Options::Scan.new(mutation_state: @mutation_state) + Options::Scan.new(mutation_state: @mutation_state), ) validate_scan(scan_result, expected_ids) end diff --git a/test/scope_search_index_manager_test.rb b/test/scope_search_index_manager_test.rb index 9096b756..7e57adca 100644 --- a/test/scope_search_index_manager_test.rb +++ b/test/scope_search_index_manager_test.rb @@ -78,7 +78,7 @@ def test_index_crud Management::SearchIndex.new do |idx| idx.name = index_name idx.source_name = env.bucket - end + end, ) # Upsert requires a UUID @@ -87,7 +87,7 @@ def test_index_crud Management::SearchIndex.new do |idx| idx.name = index_name idx.source_name = env.bucket - end + end, ) end diff --git a/test/subdoc_test.rb b/test/subdoc_test.rb index 8e1da291..ed25da58 100644 --- a/test/subdoc_test.rb +++ b/test/subdoc_test.rb @@ -39,7 +39,7 @@ def test_mutate_in_increment doc_id, [ MutateInSpec.increment("value", 4), - ] + ], ) expected = {"value" => 46} diff --git a/test/test_helper.rb b/test/test_helper.rb index e35969fe..dbef1336 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -318,6 +318,6 @@ def retry_until_error(error:, duration: 10, backoff: 1) [ Minitest::Reporters::SpecReporter.new(print_failure_summary: true), Minitest::Reporters::JUnitReporter.new(Minitest::Reporters::JUnitReporter::DEFAULT_REPORTS_DIR, true, include_timestamp: true), - ] + ], ) end