Skip to content

Rubocop: Use traling comma for multi-line arguments #178

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

Merged
merged 1 commit into from
May 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,8 @@ Style/TrailingCommaInArrayLiteral:
Style/TrailingCommaInHashLiteral:
EnforcedStyleForMultiline: comma

Style/TrailingCommaInArguments:
EnforcedStyleForMultiline: comma

Layout/FirstHashElementIndentation:
EnforcedStyle: consistent
2 changes: 1 addition & 1 deletion bin/fetch-stats
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion examples/analytics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
2 changes: 1 addition & 1 deletion examples/managing_analytics_indexes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion examples/managing_query_indexes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion examples/range_scan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion lib/active_support/cache/couchbase_store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/couchbase/cluster.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
2 changes: 1 addition & 1 deletion lib/couchbase/collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions lib/couchbase/collection_options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -391,7 +391,7 @@ def each
expiry: resp[:expiry],
encoded: resp[:encoded],
flags: resp[:flags],
transcoder: @transcoder
transcoder: @transcoder,
)
end
end
Expand Down
8 changes: 4 additions & 4 deletions lib/couchbase/management/analytics_index_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -857,16 +857,16 @@ 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(
entry[:link_name],
entry[:dataverse],
account_name: entry[:account_name],
blob_endpoint: entry[:blob_endpoint],
endpoint_suffix: entry[:endpoint_suffix]
endpoint_suffix: entry[:endpoint_suffix],
)
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/couchbase/protostellar/cluster.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/couchbase/protostellar/collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def query_indexes
client: @client,
bucket_name: @bucket_name,
scope_name: @scope_name,
collection_name: @name
collection_name: @name,
)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions lib/couchbase/protostellar/request_generator/admin/bucket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions lib/couchbase/protostellar/request_generator/admin/collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@ 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

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

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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
26 changes: 13 additions & 13 deletions lib/couchbase/protostellar/request_generator/admin/query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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
Expand Down
Loading
Loading