Skip to content

Commit 709cfe3

Browse files
committed
Rubocop: Use traling comma for multi-line arguments
1 parent 7c23b62 commit 709cfe3

34 files changed

+144
-141
lines changed

.rubocop.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,8 @@ Style/TrailingCommaInArrayLiteral:
4747
Style/TrailingCommaInHashLiteral:
4848
EnforcedStyleForMultiline: comma
4949

50+
Style/TrailingCommaInArguments:
51+
EnforcedStyleForMultiline: comma
52+
5053
Layout/FirstHashElementIndentation:
5154
EnforcedStyle: consistent

bin/fetch-stats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Net::HTTP.start("rubygems.org", use_ssl: true) do |client|
2727
puts JSON.pretty_generate(
2828
versions: stats,
2929
total: stats.values.sum,
30-
total3: stats.filter_map { |version, downloads| downloads if version.match?(/^3.\d+.\d+/) }.sum
30+
total3: stats.filter_map { |version, downloads| downloads if version.match?(/^3.\d+.\d+/) }.sum,
3131
)
3232
end
3333
end

examples/analytics.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@
182182

183183
puts "---- inner join"
184184
res = cluster.analytics_query(
185-
"SELECT * FROM #{dataverse_name}.GleambookUsers u, #{dataverse_name}.GleambookMessages m WHERE m.authorId = u.id"
185+
"SELECT * FROM #{dataverse_name}.GleambookUsers u, #{dataverse_name}.GleambookMessages m WHERE m.authorId = u.id",
186186
)
187187
res.rows.each do |row|
188188
puts "#{row['u']['name']}: #{row['m']['message'].inspect}"

examples/managing_analytics_indexes.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def measure(msg)
3030
manager = cluster.analytics_indexes
3131
options = Management::Options::Analytics::DropDataset(
3232
ignore_if_does_not_exist: true,
33-
dataverse_name: "beer-data"
33+
dataverse_name: "beer-data",
3434
)
3535
manager.drop_dataset("beers", options)
3636
manager.drop_dataset("breweries", options)

examples/managing_query_indexes.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def display_indexes(indexes, bucket_name)
5252
cluster.query_indexes.create_index(bucket_name, index_name, %w[`type` `name`],
5353
Management::Options::Query::CreateIndex(
5454
ignore_if_exists: true,
55-
condition: "abv > 2"
55+
condition: "abv > 2",
5656
))
5757
end
5858

examples/range_scan.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
scan_type = RangeScan.new(
3333
from: ScanTerm.new("airline_1"),
34-
to: ScanTerm.new("airline_11", exclusive: true)
34+
to: ScanTerm.new("airline_11", exclusive: true),
3535
)
3636
res = collection.scan(scan_type, options)
3737

lib/active_support/cache/couchbase_store.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ def build_cluster
316316
@couchbase_options[:connection_string],
317317
::Couchbase::Options::Cluster(authenticator: ::Couchbase::PasswordAuthenticator.new(
318318
@couchbase_options[:username], @couchbase_options[:password]
319-
))
319+
)),
320320
)
321321
end
322322

lib/couchbase/cluster.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ def convert_search_result(resp, options)
391391
location.end_offset = loc[:end_offset]
392392
location.array_positions = loc[:array_positions]
393393
end
394-
end
394+
end,
395395
)
396396
end
397397
row.instance_variable_set(:@fields, r[:fields])

lib/couchbase/collection.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ def scan(scan_type, options = Options::Scan::DEFAULT)
626626
core_scan_result: @backend.document_scan_create(
627627
@bucket_name, @scope_name, @name, scan_type.to_backend, options.to_backend
628628
),
629-
transcoder: options.transcoder
629+
transcoder: options.transcoder,
630630
)
631631
end
632632

lib/couchbase/collection_options.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ def each
381381
yield ScanResult.new(
382382
id: resp[:id],
383383
id_only: resp[:id_only],
384-
transcoder: @transcoder
384+
transcoder: @transcoder,
385385
)
386386
else
387387
yield ScanResult.new(
@@ -391,7 +391,7 @@ def each
391391
expiry: resp[:expiry],
392392
encoded: resp[:encoded],
393393
flags: resp[:flags],
394-
transcoder: @transcoder
394+
transcoder: @transcoder,
395395
)
396396
end
397397
end

lib/couchbase/management/analytics_index_manager.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ def get_links(options = Options::Analytics::GetLinks.new)
846846
entry[:access_key_id],
847847
nil,
848848
entry[:region],
849-
service_endpoint: entry[:service_endpoint]
849+
service_endpoint: entry[:service_endpoint],
850850
)
851851
when :couchbase
852852
CouchbaseRemoteAnalyticsLink.new(
@@ -857,16 +857,16 @@ def get_links(options = Options::Analytics::GetLinks.new)
857857
encryption: EncryptionSettings.new(
858858
level: entry[:encryption_level],
859859
certificate: entry[:certificate],
860-
client_certificate: entry[:client_certificate]
861-
)
860+
client_certificate: entry[:client_certificate],
861+
),
862862
)
863863
when :azureblob
864864
AzureBlobExternalAnalyticsLink.new(
865865
entry[:link_name],
866866
entry[:dataverse],
867867
account_name: entry[:account_name],
868868
blob_endpoint: entry[:blob_endpoint],
869-
endpoint_suffix: entry[:endpoint_suffix]
869+
endpoint_suffix: entry[:endpoint_suffix],
870870
)
871871
end
872872
end

lib/couchbase/protostellar/cluster.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def self.connect(connection_string_or_config, *args)
9595
username: username,
9696
password: password,
9797
timeouts: Protostellar::Timeouts.from_cluster_options(options),
98-
root_certificates: params.key?("trust_certificate") ? File.read(params["trust_certificate"]) : nil
98+
root_certificates: params.key?("trust_certificate") ? File.read(params["trust_certificate"]) : nil,
9999
)
100100
new(connection_string.split("://")[1].split("?")[0], connect_options)
101101
end
@@ -160,7 +160,7 @@ def initialize(host, options = ConnectOptions.new)
160160
credentials: options.grpc_credentials,
161161
channel_args: options.grpc_channel_args,
162162
call_metadata: options.grpc_call_metadata,
163-
timeouts: options.timeouts
163+
timeouts: options.timeouts,
164164
)
165165

166166
@query_request_generator = RequestGenerator::Query.new

lib/couchbase/protostellar/collection.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def query_indexes
4949
client: @client,
5050
bucket_name: @bucket_name,
5151
scope_name: @scope_name,
52-
collection_name: @name
52+
collection_name: @name,
5353
)
5454
end
5555

lib/couchbase/protostellar/management/collection_query_index_manager.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def initialize(client:, bucket_name:, scope_name:, collection_name:)
2929
@scope_name = scope_name
3030
@collection_name = collection_name
3131
@request_generator = RequestGenerator::Admin::Query.new(
32-
bucket_name: @bucket_name, scope_name: @scope_name, collection_name: @collection_name
32+
bucket_name: @bucket_name, scope_name: @scope_name, collection_name: @collection_name,
3333
)
3434
end
3535

lib/couchbase/protostellar/request_generator/admin/bucket.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,21 +62,21 @@ def list_buckets_request(options)
6262

6363
def create_bucket_request(settings, options)
6464
proto_req = Generated::Admin::Bucket::V1::CreateBucketRequest.new(
65-
extract_bucket_settings(settings, create: true)
65+
extract_bucket_settings(settings, create: true),
6666
)
6767
create_request(proto_req, :create_bucket, options)
6868
end
6969

7070
def update_bucket_request(settings, options)
7171
proto_req = Generated::Admin::Bucket::V1::UpdateBucketRequest.new(
72-
extract_bucket_settings(settings, create: false)
72+
extract_bucket_settings(settings, create: false),
7373
)
7474
create_request(proto_req, :update_bucket, options)
7575
end
7676

7777
def delete_bucket_request(bucket_name, options)
7878
proto_req = Generated::Admin::Bucket::V1::DeleteBucketRequest.new(
79-
bucket_name: bucket_name
79+
bucket_name: bucket_name,
8080
)
8181
create_request(proto_req, :delete_bucket, options)
8282
end
@@ -114,7 +114,7 @@ def create_request(proto_request, rpc, options, idempotent: false)
114114
rpc: rpc,
115115
proto_request: proto_request,
116116
idempotent: idempotent,
117-
timeout: options.timeout
117+
timeout: options.timeout,
118118
)
119119
end
120120
end

lib/couchbase/protostellar/request_generator/admin/collection.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,23 @@ def initialize(bucket_name:)
3030

3131
def list_collections_request(options)
3232
proto_req = Generated::Admin::Collection::V1::ListCollectionsRequest.new(
33-
bucket_name: @bucket_name
33+
bucket_name: @bucket_name,
3434
)
3535
create_request(proto_req, :list_collections, options, idempotent: true)
3636
end
3737

3838
def create_scope_request(scope_name, options)
3939
proto_req = Generated::Admin::Collection::V1::CreateScopeRequest.new(
4040
bucket_name: @bucket_name,
41-
scope_name: scope_name
41+
scope_name: scope_name,
4242
)
4343
create_request(proto_req, :create_scope, options)
4444
end
4545

4646
def delete_scope_request(scope_name, options)
4747
proto_req = Generated::Admin::Collection::V1::DeleteScopeRequest.new(
4848
bucket_name: @bucket_name,
49-
scope_name: scope_name
49+
scope_name: scope_name,
5050
)
5151
create_request(proto_req, :delete_scope, options)
5252
end
@@ -62,7 +62,7 @@ def create_collection_request(scope_name, collection_name, settings, options)
6262
bucket_name: @bucket_name,
6363
scope_name: scope_name,
6464
collection_name: collection_name,
65-
**proto_opts
65+
**proto_opts,
6666
)
6767
create_request(proto_req, :create_collection, options)
6868
end
@@ -71,7 +71,7 @@ def delete_collection_request(scope_name, collection_name, options)
7171
proto_req = Generated::Admin::Collection::V1::DeleteCollectionRequest.new(
7272
bucket_name: @bucket_name,
7373
scope_name: scope_name,
74-
collection_name: collection_name
74+
collection_name: collection_name,
7575
)
7676
create_request(proto_req, :delete_collection, options)
7777
end
@@ -84,7 +84,7 @@ def create_request(proto_request, rpc, options, idempotent: false)
8484
rpc: rpc,
8585
proto_request: proto_request,
8686
idempotent: idempotent,
87-
timeout: options.timeout
87+
timeout: options.timeout,
8888
)
8989
end
9090
end

lib/couchbase/protostellar/request_generator/admin/query.rb

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ def initialize(bucket_name: nil, scope_name: nil, collection_name: nil)
3131
def get_all_indexes_request(options, bucket_name = nil)
3232
proto_req = Generated::Admin::Query::V1::GetAllIndexesRequest.new(
3333
**location(
34-
bucket_name: bucket_name, scope_name: options.scope_name, collection_name: options.collection_name
35-
)
34+
bucket_name: bucket_name, scope_name: options.scope_name, collection_name: options.collection_name,
35+
),
3636
)
3737

3838
create_request(proto_req, :get_all_indexes, options, idempotent: true)
@@ -47,9 +47,9 @@ def create_primary_index_request(options, bucket_name = nil)
4747

4848
proto_req = Generated::Admin::Query::V1::CreatePrimaryIndexRequest.new(
4949
**location(
50-
bucket_name: bucket_name, scope_name: options.scope_name, collection_name: options.collection_name
50+
bucket_name: bucket_name, scope_name: options.scope_name, collection_name: options.collection_name,
5151
),
52-
**proto_opts
52+
**proto_opts,
5353
)
5454

5555
create_request(proto_req, :create_primary_index, options)
@@ -63,11 +63,11 @@ def create_index_request(index_name, fields, options, bucket_name = nil)
6363

6464
proto_req = Generated::Admin::Query::V1::CreateIndexRequest.new(
6565
**location(
66-
bucket_name: bucket_name, scope_name: options.scope_name, collection_name: options.collection_name
66+
bucket_name: bucket_name, scope_name: options.scope_name, collection_name: options.collection_name,
6767
),
6868
name: index_name,
6969
fields: fields,
70-
**proto_opts
70+
**proto_opts,
7171
)
7272

7373
create_request(proto_req, :create_index, options)
@@ -76,8 +76,8 @@ def create_index_request(index_name, fields, options, bucket_name = nil)
7676
def drop_primary_index_request(options, bucket_name = nil)
7777
proto_req = Generated::Admin::Query::V1::DropPrimaryIndexRequest.new(
7878
**location(
79-
bucket_name: bucket_name, scope_name: options.scope_name, collection_name: options.collection_name
80-
)
79+
bucket_name: bucket_name, scope_name: options.scope_name, collection_name: options.collection_name,
80+
),
8181
)
8282

8383
create_request(proto_req, :drop_primary_index, options)
@@ -86,9 +86,9 @@ def drop_primary_index_request(options, bucket_name = nil)
8686
def drop_index_request(index_name, options, bucket_name = nil)
8787
proto_req = Generated::Admin::Query::V1::DropIndexRequest.new(
8888
**location(
89-
bucket_name: bucket_name, scope_name: options.scope_name, collection_name: options.collection_name
89+
bucket_name: bucket_name, scope_name: options.scope_name, collection_name: options.collection_name,
9090
),
91-
name: index_name
91+
name: index_name,
9292
)
9393

9494
create_request(proto_req, :drop_index, options)
@@ -97,8 +97,8 @@ def drop_index_request(index_name, options, bucket_name = nil)
9797
def build_deferred_indexes_request(options, bucket_name = nil)
9898
proto_req = Generated::Admin::Query::V1::BuildDeferredIndexesRequest.new(
9999
**location(
100-
bucket_name: bucket_name, scope_name: options.scope_name, collection_name: options.collection_name
101-
)
100+
bucket_name: bucket_name, scope_name: options.scope_name, collection_name: options.collection_name,
101+
),
102102
)
103103

104104
create_request(proto_req, :build_deferred_indexes, options)
@@ -120,7 +120,7 @@ def create_request(proto_request, rpc, options, idempotent: false)
120120
rpc: rpc,
121121
proto_request: proto_request,
122122
idempotent: idempotent,
123-
timeout: options.timeout
123+
timeout: options.timeout,
124124
)
125125
end
126126
end

0 commit comments

Comments
 (0)