Skip to content

Commit 3f775de

Browse files
authored
Rubocop fixes (#166)
1 parent 987a0b4 commit 3f775de

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+181
-175
lines changed

.github/workflows/linters.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ jobs:
1818
- name: Set up ruby
1919
uses: ruby/setup-ruby@v1
2020
with:
21-
ruby-version: 3.0
21+
ruby-version: 3.3
2222
- name: Install dependencies
2323
run: bundle install
2424
- name: Run rubocop
25-
run: bundle exec rubocop
25+
run: |
26+
bundle exec rubocop -v
27+
bundle exec rubocop
2628
2729
clang_format:
2830
runs-on: ubuntu-20.04
@@ -54,7 +56,7 @@ jobs:
5456
- name: Set up ruby
5557
uses: ruby/setup-ruby@v1
5658
with:
57-
ruby-version: 3.0
59+
ruby-version: 3.3
5860
- name: Install dependencies
5961
run: |
6062
sudo apt-get update -y

bin/console

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ require "irb"
2020
require "open3"
2121
require "couchbase"
2222

23-
include Couchbase # rubocop:disable Style/MixinUsage for brevity
23+
include Couchbase # rubocop:disable Style/MixinUsage -- for brevity
2424

2525
customer123 = {
2626
"name" => "Douglas Reynholm",
@@ -105,4 +105,4 @@ alias collection default_collection
105105
# cluster # returns connected cluster
106106
# default_collection # returns default collection (accept bucket name, defaults to "default")
107107
# customer123 # returns sample document
108-
binding.irb # rubocop:disable Lint/Debugger start REPL
108+
binding.irb # rubocop:disable Lint/Debugger -- start REPL

bin/init-cluster

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ options = {
3939
sample_buckets: Set.new,
4040
}
4141
default_port = options[:strict_encryption] ? 18091 : 8091
42-
if (options[:cluster_run_nodes]).positive?
42+
if options[:cluster_run_nodes].positive?
4343
default_port = options[:strict_encryption] ? 19000 : 9000
4444
end
4545
options[:port] = ENV.fetch("CB_PORT", default_port).to_i

bin/jenkins/check-rubocop

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,5 @@ chruby ruby-${CB_RUBY_VERSION}
4040
bundle config set --local path ${PROJECT_ROOT}/vendor/bundle
4141

4242
bundle install
43+
bundle exec rubocop -v
4344
bundle exec rubocop

examples/analytics.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
require "couchbase"
1818

19-
include Couchbase # rubocop:disable Style/MixinUsage for brevity
19+
include Couchbase # rubocop:disable Style/MixinUsage -- for brevity
2020

21-
options = Cluster::ClusterOptions.new
21+
options = Options::Cluster.new
2222
options.authenticate("Administrator", "password")
2323
cluster = Cluster.connect("couchbase://localhost", options)
2424

@@ -202,7 +202,7 @@
202202

203203
# Named parameters
204204
puts "---- named parameters"
205-
options = Cluster::AnalyticsOptions.new
205+
options = Options::Analytics.new
206206
options.named_parameters({user_id: 2})
207207
res = cluster.analytics_query("
208208
USE #{dataverse_name};
@@ -223,7 +223,7 @@
223223

224224
# Positional parameters
225225
puts "---- positional parameters"
226-
options = Cluster::AnalyticsOptions.new
226+
options = Options::Analytics.new
227227
options.positional_parameters([2])
228228
res = cluster.analytics_query("
229229
USE #{dataverse_name};

examples/auth.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
# limitations under the License.
1616

1717
require "couchbase"
18-
include Couchbase # rubocop:disable Style/MixinUsage for brevity
18+
include Couchbase # rubocop:disable Style/MixinUsage -- for brevity
1919

20-
options = Cluster::ClusterOptions.new
20+
options = Options::Cluster.new
2121
# initializes {PasswordAuthenticator} internally
2222
options.authenticate("Administrator", "password")
2323
Cluster.connect("couchbase://localhost", options)

examples/crud.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
# limitations under the License.
1616

1717
require "couchbase"
18-
include Couchbase # rubocop:disable Style/MixinUsage for brevity
18+
include Couchbase # rubocop:disable Style/MixinUsage -- for brevity
1919

20-
options = Cluster::ClusterOptions.new
20+
options = Options::Cluster.new
2121

2222
options.authenticate("Administrator", "password")
2323
cluster = Cluster.connect("couchbase://localhost", options)

examples/managing_analytics_indexes.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
# limitations under the License.
1616

1717
require "couchbase"
18-
include Couchbase # rubocop:disable Style/MixinUsage for brevity
18+
include Couchbase # rubocop:disable Style/MixinUsage -- for brevity
1919

2020
def measure(msg)
2121
start = Time.now
2222
yield
2323
printf "%<msg>s in %<elapsed>.2f seconds\n", msg: msg, elapsed: Time.now - start
2424
end
2525

26-
options = Cluster::ClusterOptions.new
26+
options = Options::Cluster.new
2727
options.authenticate("Administrator", "password")
2828
cluster = Cluster.connect("couchbase://localhost", options)
2929

examples/managing_buckets.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
# limitations under the License.
1616

1717
require "couchbase"
18-
include Couchbase # rubocop:disable Style/MixinUsage for brevity
18+
include Couchbase # rubocop:disable Style/MixinUsage -- for brevity
1919

2020
def measure(msg)
2121
start = Time.now
2222
yield
2323
printf "%<msg>s in %<elapsed>.2f seconds\n", msg: msg, elapsed: Time.now - start
2424
end
2525

26-
options = Cluster::ClusterOptions.new
26+
options = Options::Cluster.new
2727
options.authenticate("Administrator", "password")
2828
cluster = Cluster.connect("couchbase://localhost", options)
2929

examples/managing_collections.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# limitations under the License.
1616

1717
require "couchbase"
18-
include Couchbase # rubocop:disable Style/MixinUsage for brevity
18+
include Couchbase # rubocop:disable Style/MixinUsage -- for brevity
1919

2020
def measure(msg)
2121
start = Time.now
@@ -26,7 +26,7 @@ def measure(msg)
2626
bucket_name = "travel-sample"
2727
scope_name = "myapp"
2828

29-
options = Cluster::ClusterOptions.new
29+
options = Options::Cluster.new
3030
options.authenticate("Administrator", "password")
3131
cluster = Cluster.connect("couchbase://localhost", options)
3232
bucket = cluster.bucket(bucket_name)

examples/managing_query_indexes.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# limitations under the License.
1616

1717
require "couchbase"
18-
include Couchbase # rubocop:disable Style/MixinUsage for brevity
18+
include Couchbase # rubocop:disable Style/MixinUsage -- for brevity
1919

2020
def measure(msg)
2121
start = Time.now
@@ -36,7 +36,7 @@ def display_indexes(indexes, bucket_name)
3636

3737
bucket_name = "beer-sample"
3838

39-
options = Cluster::ClusterOptions.new
39+
options = Options::Cluster.new
4040
options.authenticate("Administrator", "password")
4141
cluster = Cluster.connect("couchbase://localhost", options)
4242

examples/managing_search_indexes.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
# limitations under the License.
1616

1717
require "couchbase"
18-
include Couchbase # rubocop:disable Style/MixinUsage for brevity
18+
include Couchbase # rubocop:disable Style/MixinUsage -- for brevity
1919

2020
def measure(msg)
2121
start = Time.now
2222
yield
2323
printf "%<msg>s in %<elapsed>.2f seconds\n", msg: msg, elapsed: Time.now - start
2424
end
2525

26-
options = Cluster::ClusterOptions.new
26+
options = Options::Cluster.new
2727
options.authenticate("Administrator", "password")
2828
cluster = Cluster.connect("couchbase://localhost", options)
2929

examples/managing_users.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
# limitations under the License.
1616

1717
require "couchbase"
18-
include Couchbase # rubocop:disable Style/MixinUsage for brevity
18+
include Couchbase # rubocop:disable Style/MixinUsage -- for brevity
1919

20-
options = Cluster::ClusterOptions.new
20+
options = Options::Cluster.new
2121
options.authenticate("Administrator", "password")
2222
cluster = Cluster.connect("couchbase://localhost", options)
2323

@@ -71,7 +71,7 @@
7171

7272
# Using a user created in the SDK to access data
7373
bucket_name = "travel-sample"
74-
options = Cluster::ClusterOptions.new
74+
options = Options::Cluster.new
7575
options.authenticate("testUsername", "testPassword")
7676
user_cluster = Cluster.connect("couchbase://localhost", options)
7777
user_bucket = user_cluster.bucket(bucket_name)

examples/managing_view_indexes.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# limitations under the License.
1616

1717
require "couchbase"
18-
include Couchbase # rubocop:disable Style/MixinUsage for brevity
18+
include Couchbase # rubocop:disable Style/MixinUsage -- for brevity
1919

2020
def measure(msg)
2121
start = Time.now
@@ -38,7 +38,7 @@ def display_indexes(manager, namespace)
3838

3939
bucket_name = "beer-sample"
4040

41-
options = Cluster::ClusterOptions.new
41+
options = Options::Cluster.new
4242
options.authenticate("Administrator", "password")
4343
cluster = Cluster.connect("couchbase://localhost", options)
4444

examples/query.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616

1717
require "couchbase"
1818

19-
include Couchbase # rubocop:disable Style/MixinUsage for brevity
19+
include Couchbase # rubocop:disable Style/MixinUsage -- for brevity
2020

21-
options = Cluster::ClusterOptions.new
21+
options = Options::Cluster.new
2222
options.authenticate("Administrator", "password")
2323
cluster = Cluster.connect("couchbase://localhost", options)
2424

2525
cluster.bucket("travel-sample") # this is necessary for 6.0.x
2626

27-
options = Cluster::QueryOptions.new
27+
options = Options::Query.new
2828
options.named_parameters({type: "hotel"})
2929
options.metrics = true
3030
res = cluster.query("SELECT * FROM `travel-sample` WHERE type = $type LIMIT 10", options)

examples/query_with_consistency.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
require "couchbase"
1818

19-
include Couchbase # rubocop:disable Style/MixinUsage for brevity
19+
include Couchbase # rubocop:disable Style/MixinUsage -- for brevity
2020

21-
options = Cluster::ClusterOptions.new
21+
options = Options::Cluster.new
2222
options.authenticate("Administrator", "password")
2323
cluster = Cluster.connect("couchbase://localhost", options)
2424

@@ -42,7 +42,7 @@
4242
"data" => random_number,
4343
})
4444

45-
options = Cluster::QueryOptions.new
45+
options = Options::Query.new
4646
options.timeout = 10_000
4747
options.positional_parameters(["Brass"])
4848
options.scan_consistency = :request_plus
@@ -73,7 +73,7 @@
7373
state = MutationState.new(res.mutation_token)
7474
# state.add(*tokens) could be used to add more tokens
7575

76-
options = Cluster::QueryOptions.new
76+
options = Options::Query.new
7777
options.timeout = 10_000
7878
options.positional_parameters(["Brass"])
7979
options.consistent_with(state)

examples/range_scan.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
require 'couchbase'
1818

19-
include Couchbase # rubocop:disable Style/MixinUsage for brevity
19+
include Couchbase # rubocop:disable Style/MixinUsage -- for brevity
2020

21-
options = Cluster::ClusterOptions.new
21+
options = Options::Cluster.new
2222
options.authenticate("Administrator", "password")
2323
cluster = Cluster.connect("couchbase://localhost", options)
2424

examples/search.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
require "couchbase"
1818

19-
include Couchbase # rubocop:disable Style/MixinUsage for brevity
19+
include Couchbase # rubocop:disable Style/MixinUsage -- for brevity
2020

21-
options = Cluster::ClusterOptions.new
21+
options = Options::Cluster.new
2222
options.authenticate("Administrator", "password")
2323
cluster = Cluster.connect("couchbase://localhost", options)
2424

@@ -136,7 +136,7 @@
136136

137137
# search with facets advanced sort
138138
query = Cluster::SearchQuery.match_phrase("hop beer")
139-
options = Cluster::SearchOptions.new
139+
options = Options::Search.new
140140
options.limit = 10
141141
options.fields = %w[name]
142142
options.highlight_style = :html
@@ -168,7 +168,7 @@
168168
query = Cluster::SearchQuery.term("beer")
169169
query.field = "type"
170170

171-
options = Cluster::SearchOptions.new
171+
options = Options::Search.new
172172
options.facets = {}
173173

174174
term_facet = Cluster::SearchFacet.term("name")

examples/search_with_consistency.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
require "couchbase"
1818

19-
include Couchbase # rubocop:disable Style/MixinUsage for brevity
19+
include Couchbase # rubocop:disable Style/MixinUsage -- for brevity
2020

21-
options = Cluster::ClusterOptions.new
21+
options = Options::Cluster.new
2222
options.authenticate("Administrator", "password")
2323
cluster = Cluster.connect("couchbase://localhost", options)
2424

@@ -85,7 +85,7 @@
8585
# state.add(*tokens) could be used to add more tokens
8686

8787
query = Cluster::SearchQuery.term("doorknob")
88-
options = Cluster::SearchOptions.new
88+
options = Options::Search.new
8989
options.timeout = 10_000
9090
options.consistent_with(state)
9191
res = cluster.search_query(search_index_name, query, options)

examples/subdocument.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
# limitations under the License.
1616

1717
require "couchbase"
18-
include Couchbase # rubocop:disable Style/MixinUsage for brevity
18+
include Couchbase # rubocop:disable Style/MixinUsage -- for brevity
1919

20-
options = Cluster::ClusterOptions.new
20+
options = Options::Cluster.new
2121
options.authenticate("Administrator", "password")
2222
cluster = Cluster.connect("couchbase://localhost", options)
2323
bucket = cluster.bucket("default")

examples/view.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@
1616

1717
require "couchbase"
1818

19-
include Couchbase # rubocop:disable Style/MixinUsage for brevity
19+
include Couchbase # rubocop:disable Style/MixinUsage -- for brevity
2020

21-
options = Cluster::ClusterOptions.new
21+
options = Options::Cluster.new
2222
options.authenticate("Administrator", "password")
2323
cluster = Cluster.connect("couchbase://localhost", options)
2424

2525
bucket = cluster.bucket("beer-sample")
2626
collection = bucket.default_collection
2727

28-
options = Bucket::ViewOptions.new
28+
options = Options::View.new
2929
options.reduce = true
3030
options.group_level = 1
3131
res = bucket.view_query("beer", "by_location", options)
@@ -34,7 +34,7 @@
3434
puts "#{row.key.first}: #{row.value} breweries"
3535
end
3636

37-
options = Bucket::ViewOptions.new
37+
options = Options::View.new
3838
options.limit = 10
3939
options.order = :descending
4040
res = bucket.view_query("beer", "brewery_beers", options)
@@ -52,7 +52,7 @@
5252
"type" => "brewery",
5353
})
5454
puts "\nRequest with consistency. Generated brewery name: #{unique_brewery_id}"
55-
options = Bucket::ViewOptions.new
55+
options = Options::View.new
5656
options.start_key = ["random_brewery:"]
5757
options.scan_consistency = :request_plus
5858
res = bucket.view_query("beer", "brewery_beers", options)

0 commit comments

Comments
 (0)